QUANTITY); 39 end if; 40 end; / table, along with the change date/time and the change type (update or delete). This statement can be used with any interactive tool, such as SQL*Plus or Enterprise Manager.
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.
'); end if; if deleting then dbms_output.put_line ('delete!
'); end if; end; / but only if I update the table the trigger is working. Another question: if I change the attribute "location" the trigger should tell the old value as well as the new one?
Hi, Using Hana Express edition with following version details.