32

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

Please advice

Thanks,

beetri
  • 1,039
  • 11
  • 24
  • 40

3 Answers3

57

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.

bhamby
  • 15,112
  • 1
  • 45
  • 66
  • In encountered this in versino 10. Is there a way to find which column caused this? For DB2 version 10, explanation is here : http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/topic/com.ibm.db2z10.doc.codes/src/tpc/n302.htm – Ravindra Gullapalli Aug 09 '12 at 07:25
  • If you look at the message that should come with the error, `THE VALUE OF INPUT VARIABLE OR PARAMETER NUMBER position-number IS INVALID OR TOO LARGE FOR THE TARGET COLUMN OR THE TARGET VALUE`, `position-number` should give you the number of the column that is causing your troubles. – bhamby Aug 09 '12 at 14:33
13

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.

Faisal
  • 442
  • 5
  • 13
6

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.

user3292738
  • 61
  • 1
  • 1