SQL> CREATE TABLE TEST (T Number);
The table has been created.
SQL>
SQL> CREATE OR Replace View BB Asselect * from test;
The view has been established.
SQL>
Use the establishment of an alternate trigger and apply autonomous affairs (this trigger can only be applied in view) SQL> show Err without errors. SQL> create or replace trigger aa 2 instead of insert or delete or update on bb 3 declare 4 pragma autonomous_transaction; 5 begin 6 if INSERTING then 7 insert into test values (: new.t); 8 commit; 9 elsif UPDATING then 10 update TEST 11 set t =: new.t 12 where t =: Old.t; 13 commit; 14 else 15 delete from test 16 where t =: Old.t; 17 commit; 18 end if; 19 20-comit; 21 END; 22 /
Trigger has been created
SQL> Show Err has no error. SQL>
SQL> SELECT *.
Unselected
SQL>
SQL> Create or Replace Trigger AAA 2 Before INSERT OR DELETE OR UPDATE ON TEST 3 Begin 4 raise_Application_ERROR (-20000, 'cannot INSERT / UPDATE / DELETE DIRECTLY.'); 5 end; 6 /
Trigger has been created
Time: 00: 00: 00.40sql>