Name

ACCEPT

Synopsis

ACC[EPT] user_variable [NUM[BER] | CHAR | DATE] 
   [FOR[MAT] format_specification] 
   [DEF[AULT] default_value] 
   [PROMPT prompt_text | NOPR[OMPT]] 
   [HIDE]

The ACCEPT command is used to get input from a user. For example:

ACCEPT user_password CHAR -
   PROMPT "Password: " HIDE
ACCEPT id NUMBER FORMAT "999.99"
ACCEPT report_date DATE -
   PROMPT "Date: " FORMAT "dd-mon-yyyy"

Parameters

user_variable

Is the name of the variable that you want to define.

NUM[BER] | CHAR | DATE

Is the type of data you are after.

FOR[MAT] format_specification

Is a format specification, which may be optionally enclosed in quotes.

DEF[AULT] default_value

Specifies a default value to assign to the variable.

PROMPT prompt_text

Is the prompt text displayed to the user.

NOPR[OMPT]

Indicates that you do not want the user to see a visible prompt.

HIDE

Causes SQL*Plus not to echo the user’s response back to the display. This is useful if you are prompting for a password.

Note

The syntax for the ACCEPT command has evolved significantly with the past few releases of SQL*Plus. The syntax shown here is valid for version 8.1. Not all of the clauses are available when using prior versions.

Get Oracle SQL*Plus Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.