AbhiJeet
asked on
Bad bind variable oracle
In an after update trigger I am getting bad bind variable error.
I am using two bind variable in the select statement as
Select field1, field2 from table1 t1 where t1.id = :new.id and t1.code = :new.code which is causing the error
Is there any alternate way to write this select in the trigger
I am using two bind variable in the select statement as
Select field1, field2 from table1 t1 where t1.id = :new.id and t1.code = :new.code which is causing the error
Is there any alternate way to write this select in the trigger
ASKER
It is row trigger when there is one bind variable in the select there is no issue.
Issue comes when I take two bind variables
Issue comes when I take two bind variables
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If your table t1 is the table that has the "after update for each row" trigger, you don't need to use (and you shouldn't use) a query to fetch values from the row being changed. You can simply use the PL\SQL assignment syntax like Helena suggested.
•In an AFTER statement trigger, the trigger body cannot read :NEW or :OLD. (In an AFTER row trigger, the trigger body can read but not write the :OLD and :NEW fields.)
So from your code it seems that you want to use AFTER row trigger but you have created only AFTER trigger.
I hope this can help you.