Handling long variables in SQL Query (Teradata)

Sv3n-Sk4
Sv3n-Sk4 Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 32 ✭✭✭✭

Hello everyone,

I am trying to use a "long" variable in a Teradata SQL Connection - that I am calling long because when I am using a smaller one it's working - that raises an error when trying to use it.

In my query I am using the variable as follow :

g.CUOAFFECTAGT not in ('${Codes}')

My Code variable looks like this :

"Codes": "3101,3102,3103,3106,3107,3108,3109,3144,3145"

It works, but if I had some more codes it doesn't work anymore :

g.CUOAFFECTAGT not in ('${Codes2}')

"Codes2" : "3101,3102,3103,3106,3107,3108,3109,3144,3145,3147,3166,3167,3168,3182,3183,3184,3188,3189,3194,3197,3198,3375,3376,3377,8082"

I have the following error :

Connection OK, but query failed: Failed to read data from DB, caused by: SQLException: [Teradata Database] [TeraJDBC 17.00.00.03] [Error 3535] [SQLState 22003] A character string failed conversion to a numeric value.

I don't really understand from where can come the trouble and I am not able to cast anything in my IN condition.

That's why I am reaching you for help.

Thanks a lot.

Hadrien


Operating system used: Windows


Operating system used: Windows

Setup Info
    Tags
      Help me…