![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
SQL0420N Invalid character found in a character string argument of the function "DECFLOAT". SQLSTATE=22018 SELECT DISTINCT ID, ELEMENT FROM DATA WHERE ID IN(SELECT TRANSLATE(IN_STRING,',','+') FROM DATA1 WHERE ID = 901773); |
#3
| |||
| |||
|
|
SQL0420N Invalid character found in a character string argument of the function "DECFLOAT". SQLSTATE=22018 SELECT DISTINCT ID, ELEMENT FROM DATA WHERE ID IN(SELECT TRANSLATE(IN_STRING,',','+') FROM DATA1 WHERE ID = 901773); |
#4
| |||
| |||
|
|
I am using DB2 v9.7.1 and I have a column named for arguments sake 'IN_STRING' defined as VARCHAR(250) The contents of which are for example '246485+522831+1431234'. Now what I an 'trying' to do is use this value in an SQL Query as an 'IN" clause, ie 246485,522831,1431234) so I am using TRANSLATE to getrid of the '+' and substitute a comma. I can do so by using TRANSLATE(IN_STRING,',','+') which by itself works just fine. The problem I have however is whenever I add the IN clause I get the following error: SQL0420N Invalid character found in a character string argument of the function "DECFLOAT". SQLSTATE=22018 From what I can tell the problem is something to do with the length of the result and for the life of me I cannot get it to TRIM, STRIP or anything to get rid of either leading or trailing spaces, especially when using TRANSLATE. Now given that the column IN_STRING is varchar(250) the results can contain values such as: 123456 1786886+76759762 652867+878766828+71282638+6222826+12345573489 etc This seems like it should be the easiest thing in the world but for the life of me I cannot get it to work as a simple value in an SQL IN clause. Nor for that matter can I STRIP or TRIM the field.I have tried TRIMing before TRANSLATEing and visa versa but nothing appears to work. Any assistance would be very greatly appreciated. Tim Query example: SELECT DISTINCT ID, ELEMENT FROM DATA WHERE ID IN(SELECT TRANSLATE(IN_STRING,',','+') FROM DATA1 WHERE ID = 901773); Tim, |
#5
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |