Search code examples
oraclesqlplus

Why does SQL*Plus commit on exit?


Surely this should be the same as a termination of a session and cause a rollback? It seems to me to be the most un-Oracle thing possible. I was actually shocked when I found out that it did this

More importantly - would anyone object if Oracle changed it to rollback on exit?


Solution

  • Funnily enough, with the 11gR2 release this week (2009-09-03), SQL*Plus now has an option to COMMIT or ROLLBACK on EXIT. Doc here

    I'd guess in the next few weeks/months, there'll be an 11gR2 Instant Client which you can use against your current database and get your desired behaviour

    A caution to be aware of. If you DISCONNECT or CONNECT to a different session, it will still implicitly commit the transaction (according to the doc).