Personal tools
You are here: Home DB2 Problem Resolution General errors Can not rollback to save point
Navigation
Log in


Forgot your password?
 
Document Actions

Can not rollback to save point

db2 UPDATE COMMAND OPTIONS USING c off

If you getting the error below:

 

------------------------------ Commands Entered ------------------------------
UPDATE MYTABLE SET COL1=3 WHERE COL1=2;
SAVEPOINT S1 ON ROLLBACK RETAIN CURSORS;
INSERT INTO MYTABLE (COL1) VALUES (6);
ROLLBACK TO SAVEPOINT S1;
------------------------------------------------------------------------------
UPDATE MYTABLE SET COL1=3 WHERE COL1=2
DB20000I  The SQL command completed successfully.
 
SAVEPOINT S1 ON ROLLBACK RETAIN CURSORS
DB20000I  The SQL command completed successfully.
 
INSERT INTO MYTABLE (COL1) VALUES (6)
DB20000I  The SQL command completed successfully.
 
ROLLBACK TO SAVEPOINT S1
DB21034E  The command was processed as an SQL statement because it was not a
valid Command Line Processor command.  During SQL processing it returned:
SQL0880N  SAVEPOINT "S1" does not exist or is invalid in this context.

 

It is because your auto-commit is ON, to use the option ROLLBACK TO SAVEPOINT <savepoint_name>,  you have to turn off your auto-commit, see two commands below to turn off the auto-commit.

db2 UPDATE COMMAND OPTIONS USING c off

or

run your commands with options +c:

db2 +c UPDATE MYTABLE SET COL1=3 WHERE COL1=2;
db2 +c SAVEPOINT S1 ON ROLLBACK RETAIN CURSORS;
db2 +c INSERT INTO MYTABLE (COL1) VALUES (6);
db2 ROLLBACK TO SAVEPOINT S1;

 

 

Security Awareness
Would you like your company to implement gamification into your security awareness program?





Polls