Accept command

SQL*XL
home

Syntax:
ACCEPT variable [PROMPT text ];

Description:
The accept command can be used to prompt for a value for a substitution variable. When no prompt is supplied it will display a message to enter a value for variable. If the variable already exists the old value will be shown so the user can change it.

Examples:
Display a message to enter an employee number before getting the data for that employee:

ACCEPT myempno PROMPT 'Enter an employee number';
select * from emp where empno = &myempno;

Display a message to enter a department number before getting the department data. The value for department should be preset to 20, the user can change it at the prompt:

DEFINE mydeptno = 20;
ACCEPT mydeptno PROMPT 'Enter the department number';
select * from dept where deptno = &mydeptno;

See also: