This shows you the differences between two versions of the page.
error-handling [2015/09/23 20:27] 127.0.0.1 external edit |
error-handling [2016/04/20 07:40] dmtolpeko |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Error Handling in PL/HQL ====== | + | ====== Error Handling in HPL/SQL ====== |
- | PL/HQL allows you to use exceptions, condition handlers and error code to handle errors. The [[configuration#plhqlonerror|plhql.onerror]] configuration option defines how PL/HQL handles errors. It accepts the following values: | + | 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) | * **Exception** (default) | ||
- | In this case when an error occurs, PL/HQL raises an exception. If there is an exception or condition handler for this error, it is executed. | + | 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** | * **Seterror** | ||
- | When Seterror is specified, PL/HQL sets the error code to SQLCODE or HOSTCODE variables and continues execution. | + | 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** | * **Stop** | ||
- | PL/HQL stops executing the script and exits. | + | HPL/SQL stops executing the script and exits. |
- | Note that you can dynamically change [[configuration#plhqlonerror|plhql.onerror]] option by executing the SET statement in the script: | + | Note that you can dynamically change [[configuration#hplsqlonerror|hplsql.onerror]] option by executing the SET statement in the script: |
<code> | <code> | ||
- | SET plhql.onerror = exception | seterror | stop; | + | SET hplsql.onerror = exception | seterror | stop; |
</code> | </code> | ||