Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: OCI_DEFAULT or OCI_COMMIT_ON_SUCCESS
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.comReceived on Sun Apr 09 2006 - 17:48:50 CDT