Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SqlException: DB2 SQL error: SQLCODE: -302, SQLSTATE: 22001, SQLERRMC: null

Tags:

db2

What does sqlcode -302 means? Where do i get the sqlcode definitions?

Please advice

Thanks,

like image 226
beetri Avatar asked Mar 08 '12 21:03

beetri


People also ask

What is Sqlerrmc?

SQLERRMC. SQLERM. CHAR(70) Contains message replacement text associated with the SQLCODE. For CONNECT and SET CONNECTION, the SQLERRMC field contains information about the connection, see Table 4 for a description of the replacement text.

What SQLCODE 438?

SQLCODE -438 is returned because the database is in Oracle compatibility mode, and in Oracle, NO_DATA_FOUND exception is a "hard" exception which must be handled. In earlier implementations of the compiler, NO_DATA_FOUND was mapped to DB2 SQLSTATE 02000(with associated SQLCODE 100).

What SQLCODE 433?

SqlException with the SQLCODE of -433, an SQLSTATE of 22001 and a reason code of " ". This error indicates that an attempt to insert a LOB value has failed because the data is too large for the database. Typically this only happens when using rulesets with large numbers of rules (for example, over a few hundred).

What is DB2 SQL error?

The DB2 error states that DB2 failed to insert the new record into the due to a primary key constraint violation. This means that there is already a record in the TI_APGROUP_0 table that has the same CATENTRY_ID value as the record you are attempting to insert.


3 Answers

You can find the codes in the DB2 Information Center. Here's a definition of the -302 from the z/OS Information Center:

THE VALUE OF INPUT VARIABLE OR PARAMETER NUMBER position-number IS INVALID OR TOO LARGE FOR THE TARGET COLUMN OR THE TARGET VALUE

On Linux/Unix/Windows DB2, you'll look under SQL Messages to find your error message. If the code is positive, you'll look for SQLxxxxW, if it's negative, you'll look for SQLxxxxN, where xxxx is the code you're looking up.

like image 95
bhamby Avatar answered Oct 14 '22 20:10

bhamby


To get the definition of the SQL codes, the easiest way is to use db2 cli!

at the unix or dos command prompt, just type

db2 "? SQL302"

this will give you the required explanation of the particular SQL code that you normally see in the java exception or your db2 sql output :)

hope this helped.

like image 38
Faisal Avatar answered Oct 14 '22 20:10

Faisal


As a general point when using a search engine to search for SQL codes make sure you put the sqlcode e.g. -302 in quote marks - like "-302" otherwise the search engine will exclude all search results including the text 302, since the - sign is used to exclude results.

like image 21
user3292738 Avatar answered Oct 14 '22 20:10

user3292738