SQL*Plus Tutorial

SQL*Plus DEFINE Command

A value can be assigned to a variable using the command DEF [INE] of SQL * PLUS.

Value defined to be used in a SELECT construction or a file of commands, the variable name prefixind with &. Variables can be emptied using UNDEF [INE].

In the following example, a variable was defined using an arithmetic expression that computes mediums. In the following construction, variable REM's used for a number of times. The variable is then empty using UNDEFINE.

SQL > DEFINE REM = ' SAL * 12 + NVL (COMM, 0) '
SQL > SELECT ENAME, JOB, < REM
SQL > FROM EMP
SQL ORDER BY REM < >;

SQL > undefine REM