Search notes:

SQL*Plus: ACCEPT

accept order_id
…
select * from orders where id = &order_id;

Add information prompt

accept order_id prompt "Enter order id: "

Ensure data type and format

accept allows to specify the data type of the entered variable:
ACCEPT var [ NUM[BER] | CHAR | DATE | BINARY_FLOAT | BINARY_DOUBLE ]
Additionally, it allows to specify a format for the entered value:
ACCEPT var [datatype] FORMAT "…"

Number

accept num number format '99.9'
Trying to enter value that does not match the specified format results in SP2-0598: "…" does not match input format "…"

Date

accept start_date date format 'yyyy-mm-dd'
Trying to enter a value that does not match the specified format results in SP2-0685: The date "…" is invalid or format mismatched "…".

Hide input

With the hide option, the entered text is not shown on the terminal. This is especially useful for entering passwords.
accept pw char prompt "Your secret: " hide

See also

SQL*Plus

Index