DB2 conditional processors play an irreplaceable role in stored procedures. In DB2, SQL stored procedures can use the DB2 conditional processor Condition Handler) to handle SQL errors in the stored procedure running SQLERROR), SQL warning SQLWARNING)
Document directory
Criteria 2.10. Conditions and handling procedures
Criteria 2.10. Conditions and handling procedures
Limit 2.10.1. Declare Condition
Listen 2.10.2. Declare Handler
Specific conditions must be specific. These conditions can be
Http://www.ibm.com/developerworks/cn/data/library/techarticles/dm-0604changhp/
The powerful functions provided by DB2 allow developers to create highly efficient and stable stored procedures. But for beginnersProgramIt is not easy. This article
Error Handler ExamplesHere are some examples of handler declarations:If any error condition arises (other than a not FOUND), continue execution after setting L_error=1:DECLARE CONTINUE HANDLER for SQLEXCEPTIONSET l_error=1;If any error condition
Problems encountered in the project
I. Spring transaction problems
1. Description: a in service1 calls B, B calls c in service2, and c calls d in service3
Expectation: When d throws an exception (the SQL exception is thrown in my real project), d
This article mainly helps you understand MySQL variables and conditions in depth. For more information, see
I. Overview
Variables are often used in stored procedures. the usage of variables is an important knowledge point, especially when defining
The following articles mainly describe Common Errors of DB2 databases and the correct solutions. If you are curious about Common Errors of DB2 databases and the correct solutions, the following articles will unveil its mysteries. I hope you will
Troubleshooting of exceptions in mysql stored procedures, mysql stored procedures
Define the exception capture type and handling method:
DECLARE handler_action HANDLER FOR condition_value [, condition_value] ... statement
Define the type of exception capture and how to handle it:
DECLARE handler_action Handler
for Condition_value [, Condition_value] ...
Statement
handler_action:
CONTINUE
| EXIT
| UNDO
condition_value:
--The article content through the network search combination,MySQL exception, you can customize the exception, and then apply. You can also use the system default exception to capture the app.First, the exception definition:DECLARE condition_name
Stored Procedure
A stored procedure is a logical unit composed of a group of SQL statements used to execute specific tasks. Stored procedures are used to encapsulate a group of operations or queries executed on the database server. For example,
I. Overview
Variables are often used in stored procedures, and the use of variables is an important point of knowledge, especially when defining conditions.
MySQL Version: 5.6
Definition and assignment of variables
#创建数据库
DROP DATABASE IF
1.cursor CursorsUsed to declare a data setThe declaration of the cursor must be after the variable and the condition declaration, before the handler declarationCursor Properties:
Insensitive: The server can or does not replicate its results
Define the type of exception capture and how to handle it: DECLARE handler_action Handler for Condition_value [, Condition_value] ... Statement handler_action: CONTINUE | EXIT | UNDO
I checked a lot of information on the Internet and found that mysql exception handling information is a list of error numbers. during normal operation, we may want to record more accurate error messages to the log.
I checked a lot of information on
1. SampleProblem: LogOfFailures problem example: When an INSERT failure occurs in a fault record, I hope to record it in the log file. It is common to show the error handling problem example. I want to get an error record. When the INSERT operation
MySql stored procedure exception handling example bitsCN.com
MySql stored procedure exception handling example:
I checked a lot of information on the internet and found that the exception handling information about mysql is a list of error numbers,
The following is the sample code. When an exception occurs, the exception information is stored in the log table and the subsequent statements are run.
If you have better suggestions, please kindly advise.
Example of handling Stored Procedure
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.