View previous topic :: View next topic
|
Author |
Message |
lvbntapasvi
New User
Joined: 20 Jul 2006 Posts: 30
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
bhairon singh rathore
New User
Joined: 19 Jun 2008 Posts: 91 Location: banglore
|
|
|
|
Why dont you test it with IS NUMERIC clause |
|
Back to top |
|
|
lvbntapasvi
New User
Joined: 20 Jul 2006 Posts: 30
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
It will probably help someone help you if you post the host-variable value that is causing the error. . . |
|
Back to top |
|
|
|