|
|
Oracle allows variables to be defined in several places -
| Substitution SQL*Plus |
Host/Bind SQL*Plus or other Host Program |
PL/SQL Stored Procedure |
|
| Where to use | For passing values into an SQL script. | For passing values out of a PL/SQL block | Used only within a PL/SQL block |
| How to initialise and assign | DEFINE ACCEPT && & |
VARIABLE |
DECLARE := |
| Prefix | & | : | none |
| How to Examine | DEFINE var_name | DBMS_OUTPUT.put_line or assign to a bind variable or simply write values into a table. |
|
Related commands
If you are using Java stored procedures then you can add Java variables to the
above.
defined as:
datatype variable_name;
where datatype is: string, char, boolean, byte, short, int, long, float,
double, or a class variable.