Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL: commit, savepoint and roll
A copy of this was sent to "Peter Laursen" < ptl_at_edbgruppen.dk>
(if that email address didn't require changing)
On 26 Jul 1999 09:11:32 GMT, you 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?
>
begin
insert into a values ( 1 );
insert into b values ( 2 );
end;
they either will BOTH succeed or not. nothing else can happen.
>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?
>
autocommit is a sqlplus thing, no need to worry about it. if autocommit is TRUE, after the plsql block is executed, sqlplus is issue a COMMIT commiting either BOTH rows into the database (or neither if either insert failed)
>Thanks
>Peter
>
--
See http://govt.us.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'...
Current article is "Part I of V, Autonomous Transactions" updated June 21'st
Thomas Kyte tkyte_at_us.oracle.com Oracle Service Industries Reston, VA USA
Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Mon Jul 26 1999 - 07:55:48 CDT