Answered Questions

  • Can we use commit or rollback command in the exception part of PL/SQL block?

    Star Read Best Answer

    Editorial / Best Answer

    Answered by: answertoyourquery

    • Nov 9th, 2005


    Yes, we can use the TCL commands(commit/rollback) in the exception block of a stored procedure/function. The code in this part of the program gets executed like those in the body without any restriction. You can include any business functionality whenever a condition in main block(body of a proc/func) fails and requires a follow-thru process to terminate the execution gracefully!

    Leena Roja

    • Jul 13th, 2015

    Correct Subhash..

    Susil Kumar Nagarajan

    • Jan 21st, 2012

    Yes. You can very well use COMMIT or ROLLBACK in exception block. But it is not a good idea to use, as it will commit the previous transactions in the same PLSQL block. Make use of creating SAVEPOINTS and commiting them when required.