Skip to Main Content
  • Questions
  • Transaction commit when exiting SQL*Plus

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, Gyan Bahadur.

Asked: March 09, 2017 - 8:07 am UTC

Last updated: March 09, 2017 - 10:40 am UTC

Version: 11.2.0.4

Viewed 10K+ times! This question is

You Asked

if the case of exit without commit from sqlplus, the running transaction commit or rollback??

and Chris said...

It depends upon what the exitcommit parameter is set to!

SQL> create table t (x integer);

Table created.

SQL> insert into t values (1);

1 row created.

SQL> sho exitcommit
exitcommit ON
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

C:\windows\system32>sqlplus chris/chris@db12c

SQL*Plus: Release 12.1.0.2.0 Production on Thu Mar 9 10:37:47 2017

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Last Successful login time: Thu Mar 09 2017 10:37:11 +00:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SP2-0158: unknown SET option "sqlformat"
SQL> select * from t;

         X
----------
         1

SQL> set exitcommit off
SQL> delete t;

1 row deleted.

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

C:\windows\system32>sqlplus chris/chris@db12c

SQL*Plus: Release 12.1.0.2.0 Production on Thu Mar 9 10:38:06 2017

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Last Successful login time: Thu Mar 09 2017 10:37:50 +00:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SP2-0158: unknown SET option "sqlformat"
SQL> select * from t;

         X
----------
         1


See also Connor's video on this:

https://www.youtube.com/watch?v=uCgbxGayjXA

Rating

  (2 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

A reader, April 27, 2019 - 11:40 am UTC

SELECT "NUMBER" ,current_phase ,orig_operator,orig_date_entered,requestedDate,close_time ,approval_status,affected_item,assets ,brief_description,category,zproduct_type,assign_dept,coordinator,requested_by,zpriority,zsupport_dept FROM HPSMPROD.CM3RM1 WHERE ORIG_DATE_ENTERED BETWEEN LAST_DAY(ADD_MONTHS(SYSDATE, -2)) + 1 AND LAST_DAY(ADD_MONTHS(SYSDATE, -1)) order by orig_date_entered ASC;

A reader, March 10, 2020 - 1:14 pm UTC


More to Explore

VLDB

If you are new to partitioning, check out Connor McDonald's introduction series here.

VLDB

Documentation set on VLDB and Partitioning.