triggers [message #37731] |
Mon, 25 February 2002 20:29 |
krishna
Messages: 141 Registered: October 1998
|
Senior Member |
|
|
My trigger's intention is to prevent user to update salary column of employee2 table with a salary greater than 4000
User name is plsql
My trigger is
create or replace trigger t3
after insert or update on employee2
for each row
declare
new_sal number(6);
begin
/*select sum(sal) into new_sal from employee2;*/
new_sal:=:new.sal;
if new_sal>4000 then
RAISE_APPLICATION_ERROR(-20001,'Error raised');
else dbms_output.put_line('');
end if;
end;
My trigger is getting created successfully but when i try to increase BLAKE's salary in employee2 table by 7000, I get the following error.
ERROR at line 1:
ORA-20001: Error raised
ORA-06512: at "PLSQL.T3", line 8
ORA-04088: error during execution of trigger 'PLSQL.T3'
|
|
|
|