Midrange News for the IBM i Community


Posted by: Chris Proctor
Programmer Analyst
Columbia Sports Company
Portland, OR
SQL0305 - Fetch returned a null value???
has no ratings.
Published: 14 Jan 2013
Revised: 23 Jan 2013 - 1978 days ago
Last viewed on: 24 Jun 2018 (7311 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

SQL0305 - Fetch returned a null value??? Published by: Chris Proctor on 14 Jan 2013 view comments(5)

Hi all. I'm receiving the following error in my joblog numerous times and it appears, according to the message, that the select is returning a null value to the host variable (TTLOH), right? If it is possible that no value is returned, is there a way to bypass the error? I'm not exactly sure what is meant by the "descriptor area", or if that's something that I need to create or change.

 

Here's the error:

CAUSE . . . . . : A FETCH, EMBEDDED SELECT, CALL, GET DESCRIPTOR, OR A SET

OR VALUES INTO STATEMENT HAS RESULTED IN A NULL VALUE, BUT AN INDICATOR

VARIABLE WAS NOT SPECIFIED FOR HOST VARIABLE TTLOH. THE RELATIVE POSITION

OF THE HOST VARIABLE IN THE INTO CLAUSE OR PARAMETER LIST IS 6. IF THE HOST

VARIABLE NAME IS *N, A DESCRIPTOR AREA WAS SPECIFIED. IF THIS ERROR OCCURS

ON A GET DESCRIPTOR STATEMENT, THE NULL VALUE IS BEING RETURNED BUT THE

INDICATOR ITEM WAS NOT SPECIFIED ON THE GET DESCRIPTOR STATEMENT. RECOVERY

. . . : SPECIFY AN INDICATOR VARIABLE, AND PRECOMPILE THE PROGRAM AGAIN.

IF THIS IS A GET DESCRIPTOR STATEMENT, SPECIFY BOTH THE DATA ITEM AND THE

INDICATOR ITEM. PRECOMPILE THE PROGRAM AGAIN.

 

And here's the SQL statement:

 

C/EXEC SQL

C+ SELECT sum(A.ISHAND) into :TTLOH FROM INSBAL A WHERE

C+ A.ISTORE = :STRNUM AND A.IDEPT = :IDEPT AND A.ISDEPT = :ISDEPT

C+ AND A.ICLAS = :ICLAS AND A.ISCLAS = :ISCLAS AND A.ISHAND > 0

C/END-EXEC

 

Thanks!

Chris                                 

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS