Data present in the column still SQLCODE is 100



IBM's flagship relational database management system

Data present in the column still SQLCODE is 100

Postby kumarjitendra » Mon Mar 07, 2016 7:50 pm

Hi,

I have written a DB2 query to fetch a column from table depending on certain where clause. Query is returning the value present in the column but its setting SQL return code to true. I have coded my program in such a way that it abends if SQL code other 0 comes.

Please help on how to resolve this problem.

Thanks in advance.
kumarjitendra
 
Posts: 2
Joined: Mon Mar 07, 2016 7:45 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Data present in the column still SQLCODE is 100

Postby NicC » Mon Mar 07, 2016 7:58 pm

Show the relevant code. Note that a code of 100 is a successful return code - not an error.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Data present in the column still SQLCODE is 100

Postby kumarjitendra » Mon Mar 07, 2016 8:03 pm

EXEC SQL                                          
SELECT                                            
     column_name                              
   INTO                                          
     :table.column_name                
   FROM                                          
     table A1                              
   WHERE                                          
     A1.date = :WS-currentdate AND            
     A1.loan_number = :table.column-name1 AND      
     A1.loan_code = :table.column-name2
END-EXEC    


Due to project restriction I can't share the actual code.
kumarjitendra
 
Posts: 2
Joined: Mon Mar 07, 2016 7:45 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Data present in the column still SQLCODE is 100

Postby prino » Mon Mar 07, 2016 10:54 pm

1) There is no SQLCODE "TRUE"

2) Did you zero the host-variable, or fill it with spaces, low or high values before executing the query, and check if you really got something back when the SQLSTATE = '02000'?
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 635
Joined: Wed Mar 11, 2009 12:22 am
Location: Vilnius, Lithuania
Has thanked: 3 times
Been thanked: 28 times

Re: Data present in the column still SQLCODE is 100

Postby NicC » Tue Mar 08, 2016 2:07 am

Due to project restriction I can't share the actual code.

In that case we cannot help you as it is, probably, the error checking that is wrong or maybe you do actually have a column that meets the criteria - the values of which you have not shown. And please use the code tags when posting code and/or data. The true alignment shows up when used.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times


Return to DB2

 


  • Related topics
    Replies
    Views
    Last post