HPL/SQL is included to Apache Hive since version 2.0
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:
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.
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.
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;