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 (not supported in iSQL*Plus) gets 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

The name of the variable that you want to define.

NUM[BER] | CHAR | DATE

The type of data you are after.

FOR[MAT] format_specification

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

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 Oracle8i and higher. Not all clauses are available when using prior versions.

Get Oracle SQL Plus Pocket Reference, 2nd Edition 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.