A trigger is a compiled procedure stored in the database. The language you use is PL/SQL. You code and compile a trigger in the same manner you code stored procedures. The following is the SQL*Plus session that creates and demonstrates a simple Insert Row trigger. This trigger calls DBMS_OUTPUT to print "executing temp_air" for each row inserted. SQL> set feedback off SQL> CREATE TABLE temp (N NUMBER); SQL> CREATE OR REPLACE TRIGGER temp_air 2 AFTER INSERT ON TEMP 3 FOR EACH ROW 4 BEGIN 5 dbms_output.put_line('executing temp_air'); 6 END; 7 / 8 SQL> INSERT INTO temp VALUES (1); -- insert 1 row executing temp_air SQL> INSERT INTO temp SELECT * FROM temp; -- insert 1 row executing temp_air SQL> INSERT INTO temp SELECT * FROM temp; -- inserts 2 rows executing temp_air executing temp_air SQL> The third INSERT statement inserted two rows into TEMP, even though this was a single SQL statement. Most insert SQL statements insert a single row; however, as shown earlier, multiple rows can be inserted with one statement. |