Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
SQL CODE -310, query

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: SQL CODE -310, query
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10327
Location: italy

PostPosted: Fri Jan 22, 2010 12:47 pm    Post subject: Reply to: SQL CODE -310, query
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    Post subject:
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    Post subject: Reply to: SQL CODE -310, query
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10327
Location: italy

PostPosted: Fri Jan 22, 2010 3:20 pm    Post subject: Reply to: SQL CODE -310, query
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

Site Director


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

PostPosted: Fri Jan 22, 2010 8:48 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts HEX value search in a DB2 query maxsubrat DB2 2 Wed Oct 04, 2017 3:04 pm
No new posts Speed-up/reduce CPU use of code prino PL/I & Assembler 0 Tue Sep 26, 2017 12:05 am
No new posts Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm
No new posts Can we limit length in concatenation ... balaji81_k DB2 7 Tue Aug 22, 2017 2:50 am
This topic is locked: you cannot edit posts or make replies. how to code for GDG in Rexx cvnlynn CLIST & REXX 13 Wed Aug 09, 2017 9:13 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us