Wednesday, January 19, 2011

Example of trigger


[1] Write a database trigger before update / delete for each statement not allowing any of these operations on the table item for qty greater than 100.
              create or replace trigger chk_qty
before update or delete on item
declare
                q item.qty % type;
                id item.ino % type;
begin
                        id:= &id;
                        select qty in q from item where ino = id;
                        if q > 100 then
dbms_output.put_line (‘can not delete or update’);
                        end if;
  end;   

No comments:

Post a Comment