SQLCODE -310 on select statement?



IBM's flagship relational database management system

SQLCODE -310 on select statement?

Postby fornanthakumar » Tue Jan 04, 2011 7:27 am

Hi,
I have an query in my application program like below,
 EXEC SQL                                             
       SELECT CENTR_NAME_X,                           
              CENTR_TYPE_C,                           
              HMLN_RGION_N                           
         INTO :CENTR-NAME-X,                         
              :CENTR-TYPE-C,                         
              :HMLN-RGION-N                           
         FROM HMLN.ONLIN_CENTR                       
        WHERE CENTR_IBT_N = :DCLHMLN-RGSTN.RGION-IBT-N
        WITH UR                                       
 END-EXEC. 


both CENTR_IBT_N and DCLHMLN-RGSTN.RGION-IBT-N declared as decimal (5,0) not null. The actual value of DCLHMLN-RGSTN.RGION-IBT-N is 00000.

While the program was executing, i have got an ABEND with SQLCODE is -31} (-310). Which is DECIMAL HOST VARIABLE OR PARAMETER number CONTAINS NON-DECIMAL DATA. I was puzzled here because while i execute the same query in spufi like below

SELECT CENTR_NAME_X,                           
              CENTR_TYPE_C,                           
              HMLN_RGION_N  FROM HMLN.ONLIN_CENTR                       
        WHERE CENTR_IBT_N = 00000;
I have got an empty result set.

Someone please help out on this.?
Regards,
Nanthu.Y.
fornanthakumar
 
Posts: 69
Joined: Fri Oct 22, 2010 1:58 pm
Has thanked: 0 time
Been thanked: 0 time

Re: SQLCODE -310 on select statement?

Postby dick scherrer » Tue Jan 04, 2011 11:39 am

Hello,

The literal 00000 is valid - the host variable is not. . .

How is this defined and what value is in this variable when the problem occurs?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: SQLCODE -310 on select statement?

Postby fornanthakumar » Sat Jan 08, 2011 11:27 pm

Hi,

Both the predicate CENTR_IBT_N and the host varibale :DCLHMLN-RGSTN.RGION-IBT-N defined as DECIMAL ( 5 , 0).

I moved zeroes to host variable :DCLHMLN-RGSTN.RGION-IBT-N.

But i am facing -310 as SQLCODE. Please clarify.
Regards,
Nanthu.Y.
fornanthakumar
 
Posts: 69
Joined: Fri Oct 22, 2010 1:58 pm
Has thanked: 0 time
Been thanked: 0 time

Re: SQLCODE -310 on select statement?

Postby dick scherrer » Sun Jan 09, 2011 9:27 am

Hello,

Well, i surely believe db2. . . Somehow the host variable CONTAINS NON-DECIMAL DATA when the sql is executed.

Suggest you show the hex value of the variable immediately before executing the SELECT.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to DB2

 


  • Related topics
    Replies
    Views
    Last post