日期:2014-05-16  浏览次数:20411 次

设置事务


set transaction isolation level read committed;
set transaction isolation level serializable;
rollback;
set transaction isolation level serializable;
rollback;
set transaction read only;
rollback;
begin
  set transaction read only;
  rollback;
end;
/
--exec dbms_transaction.read_only;
alter session set isolation_level=serializable;
rollback;
alter session set isolation_level=read committed;
begin
  execute immediate 'alter session set isolation_level=serializable';
end;
/
rollback;

ALTER SESSION SET isolation_level 与 SET TRANSACTION ISOLATION LEVEL 区别
1: set transaction readonly只能设置SERIALIZABLE | READ COMMITTED
    而ALTER SESSION SET isolation_level 可以设置任何事务

2:SET TRANSACTION ISOLATION LEVEL 设置的事务在rollback 或commit 后,就恢复到默认read COMMIT
而ALTER SESSION SET是在会话级别 有效

设置事务只能在事务语句的第一句