DB2 exception Processor type

Source: Internet
Author: User

DB2 exception processor is still unfamiliar to many new users who have just been familiar with the DB2 database. Next we will introduce the DB2 exception Processor type for you. I hope it will help you.

DB2 exception Processor type (handler-type) has the following types:

After the processor operation is complete, CONTINUE continues to execute the next statement after the exception statement is generated.

After the processor operation is complete, EXIT terminates the stored procedure and returns the control to the caller.

Before UNDO executes a processor operation, DB2 rolls back the SQL operations performed during the stored procedure. After the processor operation is complete, the stored procedure is terminated and the control is returned to the caller.
Exception processors can handle custom exceptions based on specific SQLSTATE values or classes with predefined exceptions. The predefined three types of exceptions are as follows:

The not found flag causes an exception where the SQLCODE value is + 100 or the SQLSATE value is 02000. This exception usually occurs when SELECT does not return rows.

An error occurs when the SQLCODE value is negative due to the sqlexceptioin id.

The SQLWARNING flag causes a warning exception or an exception that causes a SQLCODE value other than 100.

If a not found or SQLWARNING exception is generated and no exception processor is defined for the exception, the exception is ignored and the control flow is switched to the next statement. If an SQLEXCEPTION exception is generated and no exception processor is defined for this exception, the stored procedure fails and the control flow is returned to the caller.

The EXIT processor is called when an SQLEXCEPTION or SQLWARNING exception occurs. Before terminating the SQL program, the EXIT processor sets the variable named stmt to "ABORTED" and returns the control flow to the caller. The UNDO processor rolls back the SQL Operations completed in the Stored Procedure body before returning the control flow to the caller.
 

DB2 lock compatibility and deadlock

Deep Analysis of DB2 Lock Mechanism

Implementation of adding verification constraints to DB2

How to Create a tablespace in DB2

Introduction to the DB2 user group in Linux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.