Page 1 of 1

Autonomous Transactions

Posted: Wed 05 Jan 2011 16:10
by ahijazi
Dear Devart;
How can I initiate more than one transaction in the same connection ?? as main transaction and others sub ones

Case :

Code: Select all

  snMain :TOraSession

  tblMain: TOraTable;
     session := snMain ;

  tblSub: TOraTable;
     session := snMain ;
tblMain call startTransaction and made some modifications, before commit or rollback, i need tblSub to be able start a transaction, then roll or commit it's own modification only; without affect tblMain modifications.

can i do that with one TOraSession component ???


work around: just create two TOraSession and set pooling True


Best Regards,

Posted: Thu 06 Jan 2011 09:43
by AlexP
Hello,

Oracle doesn't allow working with more that one transaction in one session using standard methods, but you can execute a PL/SQL block or procedure in a separate transaction transaction by using the PRAGMA AUTONOMOUS_TRANSACTION directive.