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;

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.