Passing variable in SQL Query

Hi Team

Getting the following error by executing the following query
variable pp=“1234”
Query:“select PLAN_ID from SCH.PPOL where pol_id=”& pp &""

Error:
An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.Data.Odbc.OdbcException: ERROR [22018] [IBM][CLI Driver][DB2/AIX64] SQL0420N Invalid character found in a character string argument of the function “DECFLOAT”. SQLSTATE=22018

Regards,
A Manohar

Hey @Manohar1,

Please use the query below:

Query:Select PLAN_ID from SCH.PPOL where pol_id=’"+pp.tostring+"’

3 Likes

Use + instead of &

Use it like+ pp.ToString+"

Thanks
Ashwin.S

Tq @amarasto & @AshwinS2

Regards,
A Manohar

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.