IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

SQL CODE -310, query


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
lvbntapasvi

New User


Joined: 20 Jul 2006
Posts: 30

PostPosted: Fri Jan 22, 2010 12:43 pm
Reply with quote

Hi,

Few of the fields in my DB2 table are defined as DECIMAL(7,0) and DECIMAL(18,0). I entered numeric data in these fields (without any decimals, as it is mentioned as 0).

-310 : DECIMAL HOST VARIABLE OR PARAMETER CONTAINS NON-DECIMAL DATA

But still when I run my pogram I am getting SQL code -310. Can you please help me out.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10903
Location: italy

PostPosted: Fri Jan 22, 2010 12:47 pm
Reply with quote

I tend to trust db2 judgement more than Yours!

review the steps You are using to provide the <numeric> value to the sql statement
use the dclgen command to find out the proper definition for the field You are using and convert the value accordingly

with the scarce info You have given us, the only suggestion is ...
fix Your program!
Back to top
View user's profile Send private message
bhairon singh rathore

New User


Joined: 19 Jun 2008
Posts: 91
Location: banglore

PostPosted: Fri Jan 22, 2010 2:28 pm
Reply with quote

Why dont you test it with IS NUMERIC clause
Back to top
View user's profile Send private message
lvbntapasvi

New User


Joined: 20 Jul 2006
Posts: 30

PostPosted: Fri Jan 22, 2010 3:13 pm
Reply with quote

Hi Enrico, thanks for the quick reply. I am trying to implement your suggestion. While moving the data into the fields decimal or retrieving the data, can I use the fucntion DECIMAL so that the data is converted and retrieved?

Thanks in advance
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10903
Location: italy

PostPosted: Fri Jan 22, 2010 3:20 pm
Reply with quote

here is the relevant text from the manual
Quote:
-310 DECIMAL HOST VARIABLE OR PARAMETER number CONTAINS NON-DECIMAL DATA


Explanation:
DB2 received nondecimal data from either an application (in the form of a host variable), function or a stored procedure (in the form of a parameter that was passed to or from function or a stored procedure).

number
Identifies either the host variable number (if the message is issued as a result of a FETCH, INSERT, UPDATE, MERGE, DELETE, SELECT, VALUES INTO, or SET assignment statement), or the parameter number (if the message is issued as the result of the invocation of a function, or a CALL statement).
System Action:

The statement cannot be processed.

Programmer Response:

Correct the application program or stored procedure. Ensure that all decimal variables or parameters contain valid System/370 packed decimal numbers.


IIRC the DECIMAL function is used to retrieve/fetch data ...
from the post looks more like the value in the host variable is not in the proper format ( packed )
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Fri Jan 22, 2010 8:48 pm
Reply with quote

Hello,

It will probably help someone help you if you post the host-variable value that is causing the error. . .
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts DB2 Query to get the count of Unique ... DB2 2
No new posts IBM IMU Utility for Easytrieve Code t... IBM Tools 0
No new posts purge jobs with return code 0 and ret... JCL & VSAM 6
No new posts Need help with ADABAS query (COBOL-AD... All Other Mainframe Topics 1
No new posts run rexx code with jcl CLIST & REXX 15
Search our Forums:


Back to Top