Sql – Oracle “ORA-01008” Error. Variable Not Bound

oracleplsqlsql

I have just started with PL/SQL and writing a simple fundamental code. I am not getting, what is wrong with the code.

DECLARE
role_test varchar(40) := 'Programmer';
BEGIN
update veer_test set project_id=1008420 where role=:role_test;
END;

I am getting ORA-01008: not all variables bound.

Earlier I tried:

DECLARE
role varchar(40) := 'Programmer';
BEGIN
update veer_test set project_id=1008420 where role=role;
END;

This updated all the rows of the table. Well this was justifiable. But what if I want to use the same variable name as in the table. I also tried:

role=:role;

But same error ORA-01008

Best Answer

Try:

DECLARE
role_test varchar(40) := 'Programmer';
BEGIN
update veer_test set project_id=1008420 where role=role_test;
END;
Related Topic