'PLS-00049 bad bind variable While using :OLD
create or replace trigger dis_sal_his
after delete or insert or update on employee
for each row
declare
username varchar2(10);
begin
select user into username from dual;
insert into employeehistory
values(:old.id,:old.name,:old.age,:old.address,:old.salary,:old.deletedate);
end;
/
After executing The error message is displayed as:
5/89 PLS-00049 bad bind variable 'old.deletedate'
Solution 1:[1]
You can save it in a local variable (like: v_deletedate) and then use that variable in your insert command.
create or replace trigger dis_sal_his
after delete or insert or update on employee
for each row
declare
username varchar2(10);
v_deletedate date;
begin
select user into username from dual;
v_deletedate := :old.deletedate;
insert into employeehistory
values(:old.id,:old.name,:old.age,:old.address,:old.salary,v_deletedate);
end;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Abbas Najafizadeh |
