DB2 decfloat error

4.1k Views Asked by At

I receive the following error in my query:

Invalid character found in a character string argument of the function "DECFLOAT".

However I have made no changes to any of the fields I am selecting:

select
RQH.COMPANY, 
RQH.LAST_APRV_DT, 
RQH.CREATION_DATE, 
RQH.RELEASED_DATE, 
RQH.REL_OPER_ID, 
RQH.REQ_NUMBER, 
RQH.REQUESTER, 

RLN.COMPANY, 
RLN.BUYER,
RLN.DESCRIPTION, 
RLN.TRAN_UNIT_COST, 
RLN.QUANTITY, 
RLN.ITEM, 
RLN.VEN_ITEM, 
RLN.LINE_NBR, 
RLN.MANUF_CODE, 
RLN.MANUF_NBR, 
RLN.VENDOR, 
RLN.REQ_NUMBER, 
RLN.ENTERED_UOM, 


MMD.LINE_NBR, 
MMD.DOC_NBR_NUM, 

VEN.VENDOR_VNAME, 
VEN.VENDOR_GROUP, 
VEN.VENDOR

from mmd 

join rln on MMD.COMPANY = rln.COMPANY and MMD.DOC_NBR_NUM = rln.REQ_NUMBER 
    and MMD.LINE_NBR = rln.LINE_NBR

join cpy on rln.company = cpy.company

join ven on VEN.VENDOR_GROUP = cpy.VENDOR_GROUP and VEN.VENDOR = rln.VENDOR

join rqh on RLN.COMPANY = RQH.COMPANY and RLN.REQ_NUMBER = RQH.REQ_NUMBER

where ven.vendor = 20200
2

There are 2 best solutions below

3
On

One of your comparisons has a numeric data type on one side and a character data type on the other. One of the values in the character column in that pair cannot be converted to a number. Db2 data type conversion rules state that if one operand is numeric and the other one is of a character type, the character value will be implicitly coerced into a number. This will obviously fail for values that cannot be coerced. If such is a valid value, you'll need to explicitly cast the numeric column to a character data type (padding it with spaces as necessary).

1
On

If you remove the "WHERE" clause altogether, do you still get the error or does it go away?