Asp.net,SQL tips-Tricks for error resolution version 2014,2012,2008,2005,Procedural language,Stored Procedure, computer , excel macro programming,Film,Musical notations,Indian ,Western Music.

January 2, 2013

Update status of Employee using trigger in Procedural language in sql

To Update status of Employee using trigger in Procedural language in sql you can take help of following example.

create or replace trigger emp_stat_updatetrig
 before insert or update
 on emp
 for each row
 declare
 v_sal number;
 begin
    v_sal := :new.sal;
    if v_sal < 50 then
        :new.status := 'A';
    elsif v_sal = 50 then
         :new.status := 'B';
    else
         :new.status := 'C';
    end if;
 end;