I have one table in the hr schema called employee, I need to create row level trigger on this table so that whenever I try to update salary on employee table I ensure that salary not to be decreased!
I have tried this one but I get an error:
Error report: ORA-01748: only simple column names allowed here 01748. 00000 - "only simple column names allowed here
CREATE or REPLACE TRIGGER salary_dec_trigger
BEFORE UPDATE OF emp.salary
ON emp
FOR EACH ROW
BEGIN
if(:new.salary>:old.salary)
then
update emp set emp.salary=emp.salary+:new.salary where emp.employee_id=:new.employee_id;
else
rollback;
end if;
END;
/
salaryand not the qualified column nameemp.salary. Same applies toemployee_idaftertrigger instead ofbeforeBecause in your case it is trying to read the column valuesalarywhich is not yet updated.