SQL Plus - ACCEPT command (Console Interaction)

> Procedural Languages > (SQL Plus|SqlCl) (Oracle Database Console)

1 - About

The accept command reads a line of input and stores it in a given substitution variable.

Advertising

3 - Syntax

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

where:

  • variable is the variable command
  • prompt is the prompt command
  • HIDE will hide the input

4 - Example

  • For a password
ACCEPT pwd CHAR PROMPT 'Type your Password:  ' HIDE
  • For a number
ACCEPT salary NUMBER FORMAT '999.99' DEFAULT '000.0' PROMPT 'Enter weekly salary:  '
PROMPT You have enter: &salary