Reputation: 67211
i have a script which simply connect to the table in sql*plus and inserts a row in the table.
it is throwing an error as below:
SP2-0552: Bind variable "BIND" not declared
i am not able to figure out exactly what the bind variable is in the query that it is trying to insert.
Upvotes: 1
Views: 1023
Reputation:
You are trying to run a sql like this:
SELECT 1 FROM DUAL WHERE :BIND = 1;
SQL*Plus identifies :BIND
as a bind variable, but you haven't declared one in your session yet. To declare the bind variable use the VAR(IABLE)
command.
VAR BIND NUMBER
Then, you can assign a value to the variable.
EXEC :BIND := 1
Run the select
again to confirm that the bind variable is now set. Note that you can also use this variable to hold results from single-row queries.
SELECT 1 INTO :BIND FROM DUAL;
Upvotes: 4