当前位置: 代码迷 >> DB2 >> 游标FETCH出错(sqlcode=420)游标自动关闭
  详细解决方案

游标FETCH出错(sqlcode=420)游标自动关闭

热度:1248   发布时间:2013-02-26 00:00:00.0
求助:游标FETCH出错(sqlcode=420)游标自动关闭
游标在fetch的时候出错,sqlcode=420,然后进行错误处理的时候去关闭游标报出501的错误。

是游标fetch的时候出错,游标会自动关闭吗?还是出现一些固定的错误的时候游标才会自动关闭(比如sqlcode=420的错误)。


------解决方案--------------------------------------------------------
mark 学习一下 同求高手~~~~
------解决方案--------------------------------------------------------
SQL0501N The cursor specified in a FETCH or CLOSE statement is not
open.

Explanation: 

The program attempted to either: (1) FETCH using a cursor, or (2) CLOSE
a cursor at a time when the specified cursor was not open.

The statement cannot be processed.

User response: 

Check for a previous message (SQLCODE) that may have closed the cursor.
Note that after the cursor is closed, any fetches or close cursor
statements receive SQLCODE -501.

If no previous SQLCODEs have been issued, correct the application
program to ensure that the cursor is open when the FETCH or CLOSE
statement is executed.
  相关解决方案