SQLCODE built-in variable contains the return code of the last SQL statement. The code can be zero (0), negative or positive:
| SQLCODE | Result | 
| 0 | Successful execution | 
| Positive values | Warning | 
| Negative values | Error | 
Note:
DECLARE id INT; DECLARE cur CURSOR FOR 'SELECT id FROM db.orders'; OPEN cur; FETCH cur INTO id; WHILE SQLCODE = 0 THEN FETCH cur INTO id; END WHILE; CLOSE cur;
Compatibility: IBM DB2, Teradata.
Version: HPL/SQL 0.1
See also: