Context variable in SQL Querry ToracleInput

One Star

Context variable in SQL Querry ToracleInput

Hello,
I want to use parameter into a query for a ToracleInput component.

"SELECT....
FROM ....
WHERE DATECLOTURE <
(CASE WHEN " + context.Periode + "='MOIS_PASSE'
THEN LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE),-1))
ELSE SYSDATE
END)"
i have an error "non valid constant character"..
Thanks for your help..
Louis
One Star

Re: Context variable in SQL Querry ToracleInput

Hi Louis,
This is because the conevrted sql statement now contains your context.Periode as a constant. If you change your tOracleInput to the following it should work:
"SELECT....
FROM ....
WHERE DATECLOTURE <
(CASE WHEN '" + context.Periode + "'='MOIS_PASSE'
THEN LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE),-1))
ELSE SYSDATE
END)"

Regards,
Arno
One Star

Re: Context variable in SQL Querry ToracleInput

Thank you Arno !!! it's Ok !!
Regards,
Louis