Hi there, I want my SQL*Plus-Scripts to do a ROLLBACK on EXIT when there is no explicit COMMIT (or ROLLBACK) in the Skript. So i am using the AUTOCOMMIT and EXITCOMMIT settings of SQL*Plus.
According to the description in the SQL*Plus Reference Manual in section SET EXITCOMMIT the Exit Behavior is ROLLBACK if AUTOCOMMIT is OFF, EXITCOMMIT is OFF and EXIT has no COMMIT clause.
But in fact the data is commited. Did I missunderstood this functionality or is it maybe a bug in SQL*Plus?
Here is an example, which ends in unexpectedly commiting the inserted record to the database.
SET PAGESIZE 1000 NEWPAGE NONE
SET LINESIZE 5000 WRAP OFF
SET ECHO ON FEEDBACK ON
SET AUTOCOMMIT OFF
SET EXITCOMMIT OFF
WHENEVER SQLERROR EXIT 8 ROLLBACK;
INSERT INTO TAB1 SELECT MAX(I) + 1, 'Test COMMIT' FROM TAB1;
SELECT * FROM TAB1 ORDER BY 1;
SHOW AUTOCOMMIT
SHOW EXITCOMMIT
--ROLLBACK
EXIT 0
BTW If I omit the return code 0 then a ROLLBACK happens! But i need those return codes in the scripting context.
Regards Heiko