Page 1 of 1

query as parameter

Posted: Tue Feb 21, 2012 12:49 pm
by dubuku_01
Hi guys,

I tried to pass a sql query as parameter to the job through job activity in sequence job. My query contains where ('ABC') and this goes like ABC and throwing the error

Provided sql statement did not complete correctly. I tried consecutive single quotes on both sides, But still its not working. Any other workarounds. Please share.

Version : 8.0.1

Posted: Tue Feb 21, 2012 3:21 pm
by ray.wurlod
Is the SQL actually passed syntactically valid?

Posted: Tue Feb 21, 2012 7:02 pm
by chulett
Try something else to escape the quotes, like a back-slash.

Posted: Wed Feb 22, 2012 1:00 am
by dubuku_01
ray.wurlod wrote:Is the SQL actually passed syntactically valid? ...
I just gave part of the query,which gives error ray. Please suggest

Posted: Wed Feb 22, 2012 1:33 am
by kandyshandy
dubuku, did you try concatenation? ("'": "ABC" : "'") where "'" is a single quote within double quotes ;)

Posted: Wed Feb 22, 2012 3:28 am
by thanush9sep
If you are passing any parameter and you need to retain your single quotes please use escape character as Chulett said...

For example:
SELECT * FROM EMPLOYEE WHERE ENAME LIKE 'ABC'
should be passed as a parameter like
SELECT * FROM EMPLOYEE WHERE ENAME LIKE \'ABC\'
so that DataStage does not parse your single quotes or else you will end up passing on without Single Quotes
SELECT * FROM EMPLOYEE WHERE ENAME LIKE ABC