SQL> Create Table Test (T number );
The table has been created.
SQL>
SQL> Create or replace view BB as select * from test;
The view has been created.
SQL>
Use an alternative trigger and apply the autonomous transaction in it (this trigger can only be applied to the view)
SQL> show err
No error.
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 -- commit;
21 end;
22/
Trigger created
SQL> show err
No error.
SQL>
SQL> select * from test;
Unselected row
SQL>
SQL> Create or replace trigger aaa
2 before insert or delete or update on Test
3 begin
4 raise_application_error (-20000, 'Could insert/update/delete directly .');
5 end;
6/
Trigger created
Used time: 00: 00: 00.40
SQL>