
The SQL return codes are listed here numerically, you may browse through them or you may enter the code you are looking for and press the enter key to go directly to the return code description.
The codes are broken up into numeric ranges to make the HTML documents smaller and thus load faster. They are basically divided into the groups by the hundreds digit, (ie 0-99, 100-199 and etc.). However each section has the index for all the negative return codes.
-007 -010
-029 -060
-084
-101 -102
-103 -104
-105 -107
-109 -110
-111 -112
-113 -115
-117 -118
-119 -120
-121 -122
-125 -126
-127 -128
-129 -130
-131 -132
-133 -134
-136 -137
-138 -144
-150 -151
-153 -154
-156 -157
-158 -159
-160 -161
-164 -170
-171 -180
-181 -182
-183 -184
-185 -186
-187 -188
-189 -191
-198 -199
-203 -204
-205 -206
-207 -208
-219 -220
-221 -250
-251
-301 -302
-303 -304
-305 -309
-311 -312
-313 -314
-330 -331
-332 -333
-401 -402
-404 -405
-406 -407
-408 -409
-410 -411
-412 -414
-415 -416
-417 -418
-419 -421
-426 -427
-501 -502
-503 -504
-507 -508
-509 -510
-511 -512
-513 -514
-516 -517
-518 -519
-525 -530
-531 -532
-533 -534
-535 -536
-537 -538
-539 -540
-542 -551
-552 -553
-554 -555
-556 -557
-558 -559
-567 -571
-601 -602
-603 -604
-607 -612
-613 -614
-615 -616
-618 -619
-620 -621
-622 -623
-624 -625
-626 -627
-628 -629
-631 -932
-633 -634
-635 -636
-637 -638
-639 -644
-646 -647
-652 -653
-660 -661
-662 -663
-665 -666
-667 -668
-669 -670
-671 -676
-677 -678
-679 -680
-681 -682
-683 -684
-685 -686
-687 -688
-689 -690
-691 -692
-693 -694
-715 -716
-717 -718
-719 -720
-721 -722
-726 -730
-731 -732
-733 -734
-735 -736
-737 -752
-802 -803
-804 -805
-807 -811
-812 -815
-817 -818
-819 -820
-822 -840
-900 -901
-902 -904
-905 -906
-907 -908
-909 -910
-911 -913
-917 -918
-922 -923
-924 -925
-926 -927
-950
-30000 -30020
-30021 -30030
-30040 -30041
-30050 -30051
-30052 -30053
-30060 -30061
-30070 -30071
-30072 -30073
-30074 -30080
-30090
Explanation: A previous failure has placed the application process in the unconnected state. The only SQL statements that can be successfully executed from the unconnected state are CONNECT and local SET statements.
System Action: The statement cannot be executed.
Programmer Response: It is possible that no response is required because checking for -900 is one way of detecting the unconnected state. If this is not the case, the logic of the application program must be changed. For additional information, see the description of the CONNECT statement in SQL Reference.
SQLSTATE: 51018
Explanation: A system error has occurred that prevented successful execution of the current SQL statement. However, the error was not of a kind that would preclude successful execution of further SQL statements.
The error may have occurred because the length of the SQL statement is less than 0, or it exceeds the DB2 maximum length for a statement.
System Action: The statement cannot be executed. An 0FE abend is requested for the application. However, the application program may have a recovery routine and may retry SQL statements.
Programmer Response: Notify the system programmer for analysis of the abend that caused this return code.
An application program receiving this return code may retry and is not prohibited from executing further SQL statements.
SQLSTATE: 58004
Explanation: Pointer to the essential control block, either the CT or the RDA is zeroes. This precludes the successful execution of the current SQL statement, as well as any subsequent SQL statements.
System Action: The statement cannot be executed. The application program is not permitted to issue additional SQL statements. For example, a recovery routine associated with the application program may not issue additional SQL statements.
Programmer Response: Rebind the failing application program and try again. If the problem persists, examine your DBRM and make sure it matches your program.
SQLSTATE: 58005
Explanation: The SQL statement could not be executed because resource 'resource-name' of type 'resource-type' was not available at the time for the reason indicated by 'reason-code'. Refer to "DB2 Codes" for an explanation of the given reason code.
System Action: The SQL statement cannot be executed.
Programmer Response: Verify the identity of the resource that was not available. The reason the resource was unavailable can be determined by checking the specified 'reason-code' in "DB2 Codes".
SQLSTATE: 57011
Explanation: The execution of the SQL statement was terminated because a resource limit was exceeded.
The name of the resource whose limit was exceeded is 'resource-name'. It is also the name of the column in the resource limit specification table from which the limit was derived. The limit that was exceeded in CPU seconds is 'limit-amount1' and in service units it is 'limit-amount2'. The 'resource-name' may be ASUTIME, which is the number of CPU seconds permitted for each SQL statement. The maximum number of CPU seconds permitted is 'limit-amount1'. The maximum number in service units is 'limit-amount2'.
The source used to derive the limit-amount is 'limit-source' and is either the name of a resource limit specification table or a 'system parameter'. If the source is a system parameter, the resource limit specification table did not contain an applicable entry or an error occurred while accessing the table. In either case, the limit is obtained from an install (system) parameter.
System Action: The execution of this SQL statement is terminated. A record containing more detailed information about this failure is generated. If there is an SQL cursor associated with the failed instruction, its position is unchanged and a CLOSE or PREPARE command may be issued. If any other operation is attempted with the cursor, it cannot be executed and a 'SQLCODE -905' is returned. If there is no cursor, this statement has been rolled back.
Programmer Response: Determine why this SQL statement took so long and take appropriate action. Consider simplifying the SQL statement, restructuring tables and indexes, or contacting the installation group responsible for maintaining the resource limit specification tables.
An application program that receives this return code can execute additional SQL statements.
SQLSTATE: 57014
Explanation: Execution of the SQL statement failed because the requested function had been disabled by a prior error. This situation can arise if the application program has intercepted an abend (for instance, by an ON ERROR condition in a PL/I program) and continued to execute SQL statements. This situation may also arise if a DB2 CICS transaction encountered a create thread error yet continued to issue SQL requests without issuing a SYNCPOINT ROLLBACK first.
System Action: The statement cannot be executed.
Programmer Response: In general, an application program should terminate upon receipt of this return code. All subsequent attempts by the application to execute other SQL statements will also fail with the same return code. In the case of a DB2 CICS transaction, if the SQLERRP field in the SQLCA contains the module name DSNCEXT1, the transaction may issue a SYNCPOINT ROLLBACK and continue processing. If the transactions chooses to ROLLBACK and continue processing, it must be capable of correcting the s ituation that caused the create thread error to occur originally.
SQLSTATE: 51005
Explanation: A system error occurred at the remote site where the updates were made, or a communication failure with the remote site occurred. The error occurred after the request to commit the updates was transmitted to the site. The error prevents DB2 from determining whether the commit operation succeeded.
System Action: If the commit operation succeeded, the updates appear in the data stored at the remote site. If the operation did not succeed, the updates are backed out.
The SQL COMMIT operation was not completed and an 0FE abend was requested for the application. The application program, however, may have a recovery routine and may retry SQL statements.
Programmer Response: After communication has been reestablished with the remote site, you can use SQL to query the data to determine whether the COMMIT operation was successful.
An application that receives this return code is allowed to retry or execute additional SQL statements.
SQLSTATE: 58007
Explanation: The indicated authorization ID is not allowed to perform the indicated bind-type against a plan or package because entries in the RLST table prohibits binding and rebinding by this authorization ID, or all authorization IDs.
auth-id Authorization ID of the invoker of the BIND subcommand bind-type Type of bind subcommand (BIND or REBIND)
System Action: The plan or package is not bound or rebound.
System Programmer Response: If the indicated authorization ID should be allowed to bind, change the entry in the active RLST table.
SQLSTATE: 23510
Explanation: The application program has either (1) dropped a table and then attempted to access it, or (2) dropped an index and then tried to access its object table using that index.
System Action: The statement cannot be executed.
Programmer Response: The logic of the application program must be corrected such that it does not attempt to access or use an object after it has been dropped.
Dropping indexes within an application program is especially hazardous, because there is no way of determining whether or not the plan that has been generated for the application (by BIND or REBIND) actually uses a particular index for access to its object table.
SQLSTATE: 57007
Explanation: The application program has issued a DROP or ALTER against an object, and then attempted to access that object before the DROP or ALTER is completed.
System Action: The statement cannot be executed.
Programmer Response: In the case of ALTER, the logic of the application program must be modified so that a COMMIT (or the IMS/VS or CICS equivalent) is executed between the ALTER and the failing SQL statement.
For DROP, the logic of the application program should be modified such that there is no attempt to access an object after the DROP has been executed.
SQLSTATE: 57007
Explanation: The current unit of work was the victim in a deadlock, or experienced a timeout, and had to be rolled back.
The reason code indicated whether a deadlock or timeout occurred. Refer to message DSNT500I under "Service Controller, Installation (DSNT..)"
Note: The changes associated with the unit of work must be entered again.
System Action: The statement cannot be executed. The application is rolled back to the previous COMMIT.
Programmer Response: A long-running application, or an application that is likely to encounter a deadlock, should (if possible) issue frequent COMMIT commands. This can lessen the possibility of a deadlock occurring. See message DSNT376I for other possible ways to avoid future deadlocks or timeouts. On receipt of the SQLCODE -911, the application should, in general, terminate.
For more information about how IMS, CICS, and TSO handle deadlocks, see Application Programming and SQL Guide.
SQLSTATE: 40000
Explanation: The application was the victim in a deadlock or experienced a timeout. The reason code indicates whether a deadlock or timeout occurred.
Refer to message DSNT500I under "Service Controller, Installation (DSNT..)" for an explanation of 'resource-type' and 'resource-name'.
System Action: The statement cannot be executed.
Programmer Response: The application should either commit or roll back to the previous COMMIT. Then, in general, the application should terminate. See message DSNT376I for possible ways to avoid future deadlocks or timeouts.
For more information about how CICS, and TSO handle deadlocks, see Application Programming and SQL Guide.
SQLSTATE: 40502
Explanation: An error has occurred which prevents the package from being created. This SQLCODE can be issued during bind or commit processing.
System Action: The bind fails and the package is not created. If issued during commit processing, all changes to the database are rolled back. If issued during bind processing, only package creation fails. Other changes within the logical unit of work are commitable.
Programmer Response: Correct the cause of the problem and try again.
Problem Determination: Inspect the SQLCODES issued for the SQL statements of the package.
SQLSTATE: 56069
Explanation: Execution of the SQL statement failed because the communications link(s) between the local DB2 and remote server or between the requesting site and the responding site(s) no longer exist. A previous failure has caused this condition. previous failure has caused this condition.
System Action: The statement cannot be executed.
Programmer Response: In general, an application program should issue a ROLLBACK. Attempts by the application to issue SQL statements other than ROLLBACK may fail. Once the ROLLBACK has been issued, the application may resume execution.
SQLSTATE: 51021
Explanation: Authorization failed because of the error indicated by 'error-type', which may be one of the following:
System Action: The statement cannot be executed. The connection to DB2 is not established.
Programmer Response: If 'error-type' is 'user authorization', the authorization-ID specified to DB2 through your attachment facility is not valid for DB2. See your system programmer or your CICS, IMS, or TSO system administrator.
If 'error-type' is 'plan access', allocation of a requested plan is not allowed. See your system administrator.
If 'error-type' is 'duplicate exit', then you requested a duplicate exit.
If 'error-type' is 'installation-error', a logon validation exit has denied your request. See your system programmer.
Any attempts to issue SQL statements following the -922 return code will cause unpredictable results.
SQLSTATE: 42505
Explanation: Connection to DB2 failed for the reason indicated by 'condition', which may be any of the following:
Possible causes of an allocation error are:
System Action: The statement cannot be executed. The connection to DB2 is not established.
Programmer Response: If the connection failed because either DB2 or a required database, table space, table, or index was unavailable, wait until it is available before invoking the application again.
If allocation failed for an application plan, REBIND the plan to determine the problem. Error messages will be produced explaining why the plan could not be allocated.
For other types of allocation errors, installation action may be required to correct the problem.
Problem Determination: The 'reason-code', 'resource-type', and 'resource-name' may or may not be available. If they are not available, nothing will appear. If they are available, refer to "Section 4. DB2 Codes" for an explanation of the 'reason-code', 'resource-type', and 'resource-name'.
Refer to message DSNT500I under "Service Controller, Installation (DSNT..)" for an explanation of resource type and resource name. Any attempts to issue SQL statements after receiving SQLCODE -923 will cause unpredictable results.
SQLSTATE: 57015
Explanation: Connection to DB2 has failed because of an unexpected internal error, identified by the 'reason-code'.
System Action: The statement cannot be executed. The connection to DB2 is not established.
Programmer Response: Look up the abend 'reason-code' in "Section 4. DB2 Codes" for further information. The requested 'function-code' and 'return-code' may provide additional information. Any attempts to issue SQL statements following the SQLCODE -924 will cause unpredictable results.
SQLSTATE: 58006
Explanation: An application executing in either an IMS/VS or CICS environment has attempted to execute a COMMIT statement. The SQL COMMIT statement cannot be executed in these environments.
System Action: The statement cannot be executed. No commit is performed.
Programmer Response: The IMS/VS or CICS protocols should be used to commit work in these environments.
SQLSTATE: 56021
Explanation: An application executing in either an IMS/VS or CICS environment has attempted to execute a ROLLBACK statement. The SQL ROLLBACK statement cannot be executed in these environments.
System Action: The statement cannot be executed. No roll back is performed.
Programmer Response: The IMS/VS or CICS protocols should be used to rollback work in these environments.
SQLSTATE: 56021
Explanation: In the TSO environment, the user has attempted to execute an application program without first establishing the correct execution environment by issuing the DSN command. In the IMS, CICS, or call attachment facility (CAF) environment, the user has attempted to execute an application program that is not using the correct language interface module.
System Action: The statement cannot be executed.
Programmer Response: In the TSO environment, DB2 application programs should be invoked under the RUN subcommand of the DSN command processor. In the IMS, CICS or CAF environment check that the application was link-edited with or is dynamically allocating the correct language interface module. In the IMS environment, the language interface module required is DFSLI000. In the CICS environment, the language interface module is DSNCLI. In the CAF environment, the language interface module required is DSNALI. In the TSO environment, the language interface module required is DSNELI.
SQLSTATE: 51006
Explanation: One of the following conditions applies:
System Action: The statement cannot be executed. The application process is placed in the unconnected state.
Programmer Response: If the location name is specified as the value of a host variable, ensure that the name is left justified in the host variable and, if necessary, padded on the right with blanks. If this is not the problem, either SYSLOCATIONS must be updated to include the specified name, or the specified name must be changed to match a name in name, or the specified name must be changed to match a name in SYSLOCATIONS.
SQLSTATE: 52005