====== Error Handling in HPL/SQL ====== HPL/SQL allows you to use exceptions, condition handlers and error codes to handle errors. The [[configuration#hplsqlonerror|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|IF]] statement to check for error. * **Stop** HPL/SQL stops executing the script and exits. Note that you can dynamically change [[configuration#hplsqlonerror|hplsql.onerror]] option by executing the SET statement in the script: SET hplsql.onerror = exception | seterror | stop; **See also:** * [[declare-condition|DECLARE CONDITION]] * [[declare-handler|DECLARE HANDLER]] * [[sqlcode|SQLCODE]] * [[sqlstate|SQLSTATE]] * [[get-diagnostics|GET DIAGNOSTICS]] * [[signal|SIGNAL]] * [[resignal|RESIGNAL]]