Create or replace trigger emp -- before indicates the trigger before the operation -- after indicates the trigger after the operation -- up to 12 triggers can be created for each table -- before inset www.2cto.com -- before insert for each row -- after insert for each row -- before uPdate for each row -- after uPdate -- after uPdate for each row
-- The execution sequence is: #1. execute the before statement-Level Trigger. For each row affected by the statement: -- #2. execute the Level Trigger and execute the DML statement -- execute the after row-level trigger -- #3. execute the after statement-level trigger before delete on aaa -- trigger of aaa table before the delete operation for each row -- execute each trigger of the table once. If this option is not available, the entire table is executed only once. Declare www.2cto.com begin/* If you insert an aaa table, the following error occurs in row 1st: ORA-04091: Table QUERY. AAA has changed, trigger/function cannot read it ORA-06512: In "QUERY. EMP ", line 4 (QUERY indicates user, line indicates number of rows, EMP indicates trigger name) ORA-04088: trigger 'query. emp' execution error * // * insert the data before modification to the aaa_tmp log table for supervision */insert into aaa_tmp (AID, ANAME, PRICE) values (: old. AID,: old. ANAME,: old. PRICE); --: old indicates the original data, --: new indicates the inserted new data end emp; Author: blog_yuan