Create or replace trigger [email protected]@ before insert or update or delete on @[email protected] referencing old as old_emp new as new_emp for each rowbegin --when modified by the application, F_ Sync_update=null or f_sync_update=0, you do not need to update the f_sync_date timestamp at this time, and you do not need to record delete records if (: New_emp. F_sync_update is null) or (: New_emp. f_sync_update = 0) then --Insert and update operations, update timestamp f_sync_date=systimestamp and F_SYNC_ update=null if inserting or updating then select systimestamp, null into :new_ Emp. F_sync_date, :new_emp. f_sync_update from dual; end If; if inserting then --Insert the newly added record into the Operation log table insert into DATA_SYNC_B_OPERATOR (T_name, o_type, o_date, vkeys) values (' @[ Email protected] ', 1, systimestamp, @[email protected]); end if; if deleting then -- Add primary key of Delete record to Operation record table insert into DATA_SYNC_B_OPERATOR (T_name, o_type, o_date, vkeys) values (' @[email protected] ', 3, Systimestamp, @[email protected]); end if; end if;end [email protected]@;
This article is from the "write-free" blog, please be sure to keep this source http://7156680.blog.51cto.com/7146680/1790837
Oracle Create triggers