Oracle trigger if updating then dating bisexual gay sudbury ontario

create or replace trigger sales_history_tr 2 before update or delete on sales 3 for each row 4 begin 5 if (updating) then 6 insert into sales_history 7 ( CHG_DATE 8 , CHG_TYPE 9 , STORE_KEY 10 , BOOK_KEY 11 , ORDER_NUMBER 12 , ORDER_DATE 13 , QUANTITY) 14 values 15 ( sysdate 16 , 'UPDATE' 17 , :old. Notice the condition test at line 5 to determine if the event was an update or a delete. QUANTITY); 22 end; 23 / In the example, it appears that the trigger fired before the row was created. The results appear that way because of the manner that SQL*Plus retrieved the results from the buffer.Plus there is an added advantage: it allows sharing of common state between all the trigger-points using variable.