Apache Hive : HPL/SQL - SQLSTATE

Last updated: August 12, 2026

Apache Hive : HPL/SQL - SQLSTATE

SQLSTATE built-in variable contains a 5-character return status of the last SQL statement.

SQLSTATE status code consists of a 2-character class code followed by a 3-character subclass code. Class code 00 (SQLSTATE ‘00000’ i.e.) means the successful completion.

Example:

SET hplsql.onerror = seterror; -- Prevent raising an exception

SELECT 1 FROM abc.abc;
PRINT SQLSTATE;

Compatibility: IBM DB2.

See also: