query as parameter

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
dubuku_01
Participant
Posts: 79
Joined: Fri Nov 18, 2011 2:18 pm
Location: chennai

query as parameter

Post 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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Is the SQL actually passed syntactically valid?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Try something else to escape the quotes, like a back-slash.
-craig

"You can never have too many knives" -- Logan Nine Fingers
dubuku_01
Participant
Posts: 79
Joined: Fri Nov 18, 2011 2:18 pm
Location: chennai

Post 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
kandyshandy
Participant
Posts: 597
Joined: Fri Apr 29, 2005 6:19 am
Location: Singapore

Post by kandyshandy »

dubuku, did you try concatenation? ("'": "ABC" : "'") where "'" is a single quote within double quotes ;)
Kandy
_________________
Try and Try again…You will succeed atlast!!
thanush9sep
Premium Member
Premium Member
Posts: 54
Joined: Thu Oct 18, 2007 4:20 am
Location: Chennai

Post 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
Regards
LakshmiNarayanan
Post Reply