What will be the result if we try to FETCH from the CURSOR which is not OPEN? And what will be the result if we try to OPEN a CURSOR which is already opened?

DB2DatabaseBig Data Analytics

When we try to fetch the data from the CURSOR which is not open the query will fail. In this case the SQLCODE field of SQLCA will be populated with the DB2 error code - 501. As per the IBM documentation -501 error code states that−

“THE CURSOR IDENTIFIED IN A FETCH OR CLOSE STATEMENT IS NOT OPEN”

When we try to OPEN the cursor which is already open then the query will fail and we will get the error code as -502 in the SQLCODE field of SQLCA. As per the IBM documentation -502 error code states that−

“THE CURSOR IDENTIFIED IN AN OPEN STATEMENT IS ALREADY OPEN”
raja
Published on 15-Sep-2020 14:18:25
Advertisements