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: OCI_DEFAULT or OCI_COMMIT_ON_SUCCESS

Re: OCI_DEFAULT or OCI_COMMIT_ON_SUCCESS

From: Mladen Gogala <gogala_at_sbcglobal.net>
Date: Sun, 09 Apr 2006 22:48:50 GMT
Message-Id: <pan.2006.04.09.22.48.50.649621@sbcglobal.net>


On Mon, 10 Apr 2006 00:05:16 +0200, Tijs Verwest wrote:

> But I don't see any difference between OCI_DEFAULT and OCI_COMMIT_ON_SUCCESS
> both commit my insertions in the database. Can someone tell me what's the
> difference between the two?

OCI_DEFAULT does not commit on success. The session still commits on exit, that is why you don't see any difference. You session exits when your script completes successfully. If, for some reason, your session raises an exception and rolls the transaction back, it will roll back the effect of every single SQL statement issued for the duration of the session. OCI_COMMIT_ON_SUCCESS, on the other hand, is precisely the behavior known as "autocommit" frm the SQL*Plus world. It will commit every single statement on success and will, if an exception is raised, likely roll back only the statement that failed. That is not acceptable in the cases when the transaction encompasses several SQL statements which have to fail or succeed as a unit.

-- 
http://www.mgogala.com
Received on Sun Apr 09 2006 - 17:48:50 CDT

Original text of this message

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