This chapter begins with the same trigger that started Chapter 6, except this is a statement level trigger. We start with a TEMP table. DROP TABLE TEMP; CREATE TABLE temp (N NUMBER); Now create an ALTER-INSERT-STATEMENT trigger. CREATE OR REPLACE TRIGGER temp_ais AFTER INSERT ON TEMP BEGIN dbms_output.put_line('executing temp_ais'); END; The following inserts have different results than the beginning of Chapter 6, which demonstrated a ROW trigger. We begin by inserting a single row. SQL> set feedback off SQL> INSERT INTO temp VALUES (1); -- insert 1 row executing temp_ais SQL> INSERT INTO temp VALUES (1); -- insert 1 row executing temp_ais SQL> INSERT INTO temp SELECT * FROM temp; -- insert 2 rows executing temp_ais The INSERT statement fires once per SQL statement. For the last insert a row trigger would have to fire twice. |