Oracle自治事务

执行段起始处添加:

PRAGMA AUTONOMOUS_TRANSACTION;
examp:

-- Created on 2014/2/26 
declare 
  -- Local variables here
  i integer;

  PROCEDURE son IS 
    PRAGMA AUTONOMOUS_TRANSACTION; 
  BEGIN 
    UPDATE pol_main pm SET pm.old_polno = 'son' WHERE pm.polno ='GP25000000000004';
    COMMIT;
    UPDATE pol_main pm SET pm.old_polno = 'son' WHERE pm.polno ='GP25000000000005';
    COMMIT;
  END ;  
    
  PROCEDURE father IS 
    
  BEGIN 
    UPDATE pol_main pm SET pm.old_polno = 'father' WHERE pm.polno ='GP25000000000003';
    son();
    ROLLBACK;
  END ;  

BEGIN
  UPDATE pol_main pm SET pm.old_polno = 'father' WHERE pm.polno ='GP25000000000006';
  father();  
  
end;





你可能感兴趣的:(Oracle自治事务)