that it is referenced from the ANSI SQL and ODBC standards, and therefore more standardized, Unlike the above error_code is completely mysql itself defined for their own use, this and the first similar can also refer to the MySQL Database error code and information.3, Condtion_name, this is the condition name, it uses declare ... Condition statement, which we'll show you how to define your own condition_name.4. SQLWarning, which indicates that the string in sqltate starts with ' 01 ' errors, su
, this and the first analogy can also refer to MySQL database error codes and information.3, Condtion_name, this is the condition name, it uses declare ... Condition statement, we'll explain how to define our own condition_name later in this article.4, sqlwarning, which means that the string in the sqltate starts with ' 01 ', such as error:1311 sqlstate:01000 (Er_sp_uninit_var)5, not FOUND, which means that
According to the definitions in the X/open and SQL access group SQL CAE specifications (1992), sqlerror returns the sqlstate value. The sqlstate value is a string containing five characters. The following table lists the drivers.ProgramIt can be the sqlstate value returned by sqlerror.
The string value returned for sqlstate
information.
2. SQLSTATE [VALUE] sqlstate_value, which is similar to the error code and forms a one-to-one correspondence relationship. It is a five-character string, the key point is that it is referenced from ansi SQL and ODBC standards, so it is more standardized, unlike the above error_code, which is completely defined by mysql for your own use, this is similar to the first mysql database error code and information.
3. condtion_name. This is the
We have a job on the database server in the past few days occasionally encountered the following error (sensitive information has been processed), mainly reported "TCP provider:the semaphore timeout period has expired. [SQLSTATE 07008] (Error 121) OLE DB Provider "SQLNCLI" for linked server "(NULL)" returned message "Communication link failure". [SQLSTATE 01000]
. [SQLSTATE 42000] (error 7303) link server "hztmvqd" ole db access interface "OraOLEDB. Oracle" Returned message "ORA-01017: invalid username/password; login denied ". [SQLSTATE 01000] (error 7412). This step fails.Solution:1. Link to the server -- HZTMVQD right-click the property -- Security -- add an account in the ing from local sub-server logon to remote ser
connect to the data source of dBase and BTrieve at the same time, you must allocate two connections.Handle. The next section describes the SQLAllocConnect function.SQLAllocConnect allocates memory for the connection handle in the environment identified by henv. Below isSQLAllocConnect Syntax:RETCODE SQLAllocConnect (henv, phdbc)The SQLAllocConnect parameters are shown in the following table. The return code is:SQL-SUCCESSSQL-SUCCESS-WITH-INFOSQL-ERRORSQL-INVALID-HANDLEThe return code of
lines is verified. 2 indicates the new verification Value Function in version 8.0. To retry. The distributed transaction table cannot be cleared. [Sqlstate 01000] (Message 14152). Step failed. At that time, there was no time to worry about this. Because there is no performance or other impact. Today, we have time to focus on solving this problem. At first, it was suspected that the data in some system tab
username/password; Login is denied. " [SQLSTATE 01000] (Error 7412). The step failed.Solution:1. Linked server--HZTMVQD Right-click Property--Security--Add an account in the mapping of local branch login to remote server login. For example:Local login SA, remote user vqd, remote password vqd123 login mapping with SA accountLocal login NT AUTHORITY\SYSTEM, remote user vqd, remote password vqd123 login mappi
-- Declare
Declare a variable using the declare statement in the body of a batch or process and assign a value to it using the set or select statement. The cursor variable can be declared through this statement and can be used in other statements related to the cursor. All variables are initialized to null after declaration.
-- Print
The print statement uses a single character or Unicode string expression as a parameter. It returns this string as a message to the application. The message is re
Label:In MySQL, specific exceptions require specific processing. These exceptions can be linked to errors, as well as general process control in subroutines. Defining an exception is a prior definition of the problem encountered during the execution of the program, and exception handling defines how it should be handled when a problem is encountered, and ensures that the stored procedure or function can continue to execute when it encounters an error or a warning.1 Exception Definition 1.1 synta
not appear in the primary key table. But no error message.Returns because error handling is already contained in the procedure. Nothing is added to the T3 table, but the Error_log table recordsWith some information, this tells us that the INSERT into table T3 action failed.
Syntax for DECLARE HANDLER syntax declaring exception handling
DECLARE{EXIT | CONTINUE}HANDLER for{Error-number | {SQLSTATE error-string} | Condition}SQL statement
The above is th
. EXIT means to EXIT the compound statement after the action is successfully submitted.
5. Sample Problem: Log Of Errors
CALL p22 (5 )//
Calling this stored procedure will fail, which is normal because the value 5 does not appear in the primary key table. However, no error message is returned because the error processing is included in the process. Nothing is added to table t3, but some information is recorded in table error_log, which tells us that the INSERT into table t3 action fai
. However, no error message is returned because the error processing is included in the process. Nothing is added to table t3, but some information is recorded in table error_log, which tells us that the INSERT into table t3 action fails.
Declare handler syntax statement syntax for exception handling
DECLARE
{EXIT | CONTINUE}
HANDLER
{Error-number | {SQLSTATE error-string} | condition}
SQL statement
The above is the usage of error handling, t
MySQL defines the exception and exception handling methods, and MySQL defines the handling methods
In MySQL, specific exceptions must be handled. These exceptions can be associated with errors and general process control in subprograms. Defining exceptions is a problem encountered during the execution of the program in advance. Exception Handling defines the handling methods to be taken when a problem occurs, it also ensures that stored procedures or functions can continue to be executed in case
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.