5 LOOP l_tt_tab.extend; l_tt_tab(l_tt_tab.last):= i; l_tt_tab(l_tt_tab.last).description := 'Description for '
It creates a test table, a package to hold shared data and a trigger for each of the timing points.
Each trigger extends a collection defined in the package and stores a message with the trigger name and the current action it was triggered with.
The triggers from the previous section will reveal the timing points that are triggered.
SET SERVEROUTPUT ON DECLARE TYPE t_trigger_test_tab IS TABLE OF trigger_test%ROWTYPE; l_tt_tab t_trigger_test_tab := t_trigger_test_tab(); BEGIN FOR i IN 1 ..
The same is true for an " In the previous section we've seen what the timing points look like for individual statements. That depends on whether you are doing bulk inserts, updates or deletes using the statement.
The following code builds a collection of 5 records, then uses that to drive bulk inserts, updates and deletes on the TRIGGER_TEST table.
There are optional declaration and exception sections, like any other PL/SQL block, if required.
The "dml-event" can be one or more of the following.
Row-level DML triggers are not allowed to query or perform any DML on the table that fired them.
If they attempt to do so a mutating table exception is raised.
CREATE OR REPLACE TRIGGER my_test_trg BEFORE INSERT OR UPDATE OR DELETE ON my_table FOR EACH ROW BEGIN -- Flags are booleans and can be used in any branching construct. If you need some code to perform an operation that needs to commit, regardless of the current transaction, you should put it in a stored procedure defined as an autonomous transaction, shown here.