Apache Hive : HPL/SQL - SQLCODE
Table of Contents
Apache Hive : HPL/SQL - SQLCODE
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:
- SQLCODE 100 means row not found or end of cursor
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.
See also: