关键字:
pragma AUTONOMOUS_TRANSACTION;
1.创建使用自治事务的过程
SQL>create or replace procedure sp_test
2 is
3 pragma AUTONOMOUS_TRANSACTION;
4 BEGIN
5 execute immediate 'drop table test_table';
6 execute immediate 'create table test_table as select * from dual';
7 END;
8 /
Procedure created.
2.在触发器中调用该过程即可
SQL> create or replace trigger tr_test after delete on emp
2 BEGIN
3 sp_test;
4 END;
5 /
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/6906/viewspace-21697/ ,如需转载,请注明出处,否则将追究法律责任。