Search notes:
SP2-0552: Bind variable … not declared.
The error
SP2-0552: Bind variable … not declared is thrown in
SQL*Plus when
- A bind variable is used in an SQL statement without having declared that bind variable, or
- When declaring a bind variable without a datatype
:xyz
is not defined:
SQL> select :xyz from dual;
SP2-0552: Bind variable "xyz" not declared.
When declaring a
bind variable in
SQL*Plus, the datatype must be specified, otherwise the error
SP2-0552: Bind variable … not declared is thrown:
SQL> var xyz
SP2-0552: Bind variable "xyz" not declared.
Inspecting the variable
SQL> var xyz number
SQL> var xyz
variable xyz
datatype NUMBER
Assigning a value to the bind variable
SQL> exec :xyz ;= 42
Using the bind variable:
SQL> select :xyz from dual;