Apache Hive : HPL/SQL - Error Handling

Last updated: August 12, 2026

Apache Hive : HPL/SQL - Error Handling

HPL/SQL allows you to use exceptions, condition handlers and error code to handle errors. The hplsql.onerror configuration option defines how HPL/SQL handles errors. It accepts the following values:

  • Exception (default)

In this case when an error occurs, HPL/SQL raises an exception. If there is an exception or condition handler for this error, it is executed.

  • Seterror

When Seterror is specified, HPL/SQL sets the error code to SQLCODE or HOSTCODE variables and continues execution.

  • Stop

HPL/SQL stops executing the script and exits.

Note that you can dynamically change hplsql.onerror option by executing the SET statement in the script:

SET hplsql.onerror = exception | seterror | stop;

See also: