db2中无法识别savepoint

时间:2013-02-12 05:45:46

标签: db2 savepoints

我有以下查询 -

SAVEPOINT A ON ROLLBACK RETAIN CURSORS;

select max(id) from testdb.table1;

ROLLBACK TO SAVEPOINT A;

commit

我收到以下错误

ROLLBACK TO SAVEPOINT A
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 "A" does not exist or is invalid in this context.  
SQLSTATE=3B001

我是DB2的新手,我没有得到任何启动事务类型语句,但是存在提交。

如何解决此错误?

解决

我得到了关注 -

update command options using c OFF; 

SAVEPOINT A ON ROLLBACK RETAIN CURSORS;

select max(id) from testdb.table1;

ROLLBACK TO SAVEPOINT A;

commit;

update command options using c ON ;

在我的背景下工作正常。

1 个答案:

答案 0 :(得分:0)

update command options using c OFF; 

SAVEPOINT A ON ROLLBACK RETAIN CURSORS;

select max(id) from testdb.table1;

ROLLBACK TO SAVEPOINT A;

commit;

update command options using c ON ;