Page 1 of 1

Problem with sql code -304

PostPosted: Thu Mar 21, 2013 7:59 pm
by Dashimir
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.

Re: Problem with sql code -304

PostPosted: Thu Mar 21, 2013 8:08 pm
by Dashimir
It was 305 not 304 sorry

Re: Problem with sql code -304

PostPosted: Thu Mar 21, 2013 8:27 pm
by Robert Sample
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.

Re: Problem with sql code -304

PostPosted: Thu Mar 21, 2013 8:32 pm
by Dashimir
I amd coding in cobol

Re: Problem with sql code -304

PostPosted: Thu Mar 21, 2013 8:37 pm
by enrico-sorichetti
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

Re: Problem with sql code -304

PostPosted: Tue Apr 23, 2013 2:35 pm
by sinmani
You need to declare a NULL Indicator for the field.
And handle the NULL values in the column using this NULL indicator