SQL*Plus Tutorial

SQL*Plus ACCEPT Command

The ACCEPT command reads a line of input and stores it in a given user variable.

ACCEPT Command syntax

ACC[EPT] variable [NUM[BER]|CHAR|DATE] [FOR[MAT] format] [DEF[AULT] default]
[PROMPT text|NOPR[OMPT]] [HIDE]


Examples

SQL > ACCEPT PRICE NUMBER PROMPT ' Price: '
Price: 120,000

SQL > ACCEPT PASSWORD CHAR PROMPT ' Password: ' HIDE
Password:

SQL > ACCEPT TAX NUMBER NOPROMPT
20

SQL > DEFINE

DEFINE PRICE = 120,000 (NUMBER)
DEFINE PASSWORD = "Abc1234##" (CHAR)
DEFINE TAX = 20 (NUMBER)