Please tell me how to resolve the SQL syntax error.

0
When defining SQL using "CREATE VARIABLE," an error occurs at this part. SQL:TO_DATE(SUBSTRING(trgt_frm_ym, 1, 4) || '-' || SUBSTRING(trgt_frm_ym, 5, 2) || '-01', 'YYYY-MM-DD') ErrorMessage:Missing EOF at "," Please let me know the solution.
asked
1 answers
0

I think you need to look at escaping any single quotes in your SQL statement. You can do this by adding another single quote next to any single quote in your SQL.

 

For example

TO_DATE(SUBSTRING(trgt_frm_ym, 1, 4) || ''-'' || SUBSTRING(trgt_frm_ym, 5, 2) || ''-01'', ''YYYY-MM-DD'')

 

The documentation on String functions explains a bit more about escaping quotes in strings.

https://docs.mendix.com/refguide/string-function-calls/

 

Good luck!

answered