Problem with sql code -304



IBM's flagship relational database management system

Problem with sql code -304

Postby Dashimir » Thu Mar 21, 2013 7:59 pm

In a select statment i aways get sqlcode -304.

How do i provide indicator variables or how do i fix this?


A FETCH, SELECT, VALUES INTO, or SET assignment statement resulted in the retrieval of a null value to be inserted into the output host variable, designated by entry number 'position-number' of the output SQLDA, for which no indicator variable was provided. An indicator variable must be supplied if a column returns a null value.
Examine the definition of the table that is the object of the statement and correct the application program to provide indicator variables for all host variables into which null values can be retrieved. This includes host variables for columns which can contain null values and host variables which receive the results of column functions whose result table could be empty.

Thank you in advance.
Dashimir
 
Posts: 42
Joined: Wed Dec 26, 2012 7:27 pm
Has thanked: 2 times
Been thanked: 0 time

Re: Problem with sql code -304

 

Re: Problem with sql code -304

Postby Dashimir » Thu Mar 21, 2013 8:08 pm

It was 305 not 304 sorry
Dashimir
 
Posts: 42
Joined: Wed Dec 26, 2012 7:27 pm
Has thanked: 2 times
Been thanked: 0 time

Re: Problem with sql code -304

Postby Robert Sample » Thu Mar 21, 2013 8:27 pm

Since the error message mentions output host variables, which language are you using? The specific method of using an indicator variable will depend upon the language you are coding in.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 222 times

Re: Problem with sql code -304

Postby Dashimir » Thu Mar 21, 2013 8:32 pm

I amd coding in cobol
Dashimir
 
Posts: 42
Joined: Wed Dec 26, 2012 7:27 pm
Has thanked: 2 times
Been thanked: 0 time

Re: Problem with sql code -304

Postby enrico-sorichetti » Thu Mar 21, 2013 8:37 pm

it does not seem that difficult to google for COBOL DB2 INDICATOR VARIABLES
to arrive for example at
http://pic.dhe.ibm.com/infocenter/dzich ... ecobol.htm

or at
http://www.columbia.edu/acis/rad/db2/do ... m#db2a0179
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2643
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 130 times

Re: Problem with sql code -304

Postby sinmani » Tue Apr 23, 2013 2:35 pm

You need to declare a NULL Indicator for the field.
And handle the NULL values in the column using this NULL indicator
-----------------------------------------
As long as you think you are a student, you are doing well.
The day you consider yourself as the master of the game..........well
sinmani
 
Posts: 93
Joined: Thu Mar 22, 2012 10:02 am
Has thanked: 14 times
Been thanked: 0 time


Return to DB2

 


  • Related topics
    Replies
    Views
    Last post