Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL: commit, savepoint and roll

Re: PL/SQL: commit, savepoint and roll

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Mon, 26 Jul 1999 20:58:38 +0800
Message-ID: <379C5B7E.28FD@yahoo.com>


Peter Laursen wrote:
>
> Hello All
> I need to do two inserts stmts in a PL/SQL procedure. Either both must fail
> or both may commit.
>
> Could someone give a simple codeexample?
>
> How do I deal with autocommit? Must I save the original autocommit value,
> set it to false and then reset it to its original value?
>
> Thanks
> Peter

The really nice thing about PL/SQL is that (assuming you do not override with your own commits/rollbacks) it is its own logical unit of work...

so for example:

proc XXX is
begin

   insert.. 
   update...
   delete...

   more inserts..

   etc etc
end;

if any one of these sql's fail, then all will be rolled back...

Cheers

--



Connor McDonald
"These views mine, no-one elses etc etc" connor_mcdonald_at_yahoo.com

"Some days you're the pigeon, and some days you're the statue." Received on Mon Jul 26 1999 - 07:58:38 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US