User Tools

Site Tools


HPL/SQL is included to Apache Hive since version 2.0


Error Handling in HPL/SQL

HPL/SQL allows you to use exceptions, condition handlers and error codes to handle errors. The hplsql.onerror configuration option defines how HPL/SQL handles errors in the current session. 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, ERRORCODE and HOSTCODE (for OS commands) variables and continues execution. You can use IF statement to check for error.

  • 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: