Errors Associated with Select and Function Cursors
Because the database server is seeing the query for the first time, it might detect errors. In this case, it does not actually return the first row of data, but it resets the SQLCODE variable and the sqlca.sqlcode field of the sqlca. The value is either negative or zero, as the following table describes.
- Code Value
- Significance
- Negative
- An error was detected in the SELECT statement
- Zero
- The SELECT statement is valid
Unlike ESQL/C routines, SPL routines do not have direct access to the sqlca structure. An ESQL/C routine must invoke the built-in SQLCODE function explicitly to access the return code of the SELECT, EXECUTE FUNCTION, or EXECUTE PROCEDURE statement associated with the cursor that OPEN references.
100
(SQLNOTFOUND
),
meaning that no rows were found.