自治事务和非自治事务的区别

自治事务和非自治事务的区别

发布: admin | 类别: 数据库相关 | 点击:2364 | 更新时间:2012-05-10 21:30:32

0 条评论

  下面是个简单的测试,可以让大家更加清楚的明白自治事务和非自治事务的区别:          SQL> create table chris_test (name varchar2(200));
        Table created.
        SQL> create or replace procedure Autonomous_insert
         as
         pragma autonomous_transaction;
         begin
         insert into chris_test values (’Autonomous Insert!’);
         commit;
         end;
        Procedure created.
        SQL> create or replace procedure Nonnomous_insert
         as
         begin
         insert into chris_test values (’Nonnomous Insert!’);
         commit;
         end;
        Procedure created.
        SQL> begin
         insert into chris_test values (’Anonymous Block!’);
         Nonnomous_insert;
         rollback;
         end;
        PL/SQL procedure successfully completed.
        SQL> select * from chris_test;
        NAME
        ------------------------------------------------          Anonymous Block!
        Nonnomous Insert!
        SQL> truncate table chris_test;
        Table truncated.
        SQL> begin
         insert into chris_test values (’Anonymous Block!’);
         Autonomous_insert;
         rollback;
         end;
        PL/SQL procedure successfully completed.
        SQL> select * from chris_test;
        NAME
       ---------------------------------------------- 
        Autonomous Insert!

0 条评论

 

欢迎留下您的评论

红框选项必须输入,不允许html代码。

联系我们

  • Address: Floor.15,Building No.1,Idealism center ,No.38 Tianyi Street, Chengdu high tech Zone,Sichuan China, 610000
  • Phone Number: 18908191278 028-61408608
  • Website: www.drawnet.cn
  • QQ: 464410235
  • WeChat: 464410235
  • Email: master@drawnet.cn

关于我们

关注微信公众号

扫码关注微信服务号

进入微信小程序

扫码进入微信小程序