I was always doing a commit before exiting SQL*Plus when it occurred to me today that maybe I didnâ€™t need to do that. Doing a Google search quickly answered that for me.
If you issue a graceful exit (via the â€œexitâ€ or â€œquitâ€ command), sqlplus will always issue a commit. However, if you were to be ungracefully disconnected, for example by closing your terminal window, then PMON will issue a rollback like it does with any other disconnected session.
Therefore there is no need to do a commit before you exit.
You can also set autocommit on, it is off by default, but I would not recommend doing this.
During interactive usage with sqlplus, Oracle also supports an AUTOCOMMIT option. With this option set to ON each individual SQL statement is treated as a transaction an will be automatically commited right after it is executed. A user can change the AUTOCOMMIT option by typingSET AUTOCOMMIT ON
orSET AUTOCOMMIT OFF
whereas by typingSHOW ALL
a user can see the current setting for the option (including other ones).