Passing SQL as job parameter

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
tkozlows
Premium Member
Premium Member
Posts: 13
Joined: Tue Dec 03, 2002 7:31 pm
Location: Melbourne, Australia

Passing SQL as job parameter

Post by tkozlows »

Hi,

I am writing a generic job that will accept SQL statement as one of its parameters. The SQL extracts data from a source table. The job then loads the extracted data into the target.

Oracle --> Xform --> Oracle

No columns are defined - I'm using 'Runtime column propagation'.

The job works fine until I include quoted literals in the SQL that is passed to the job, eg.

SELECT COLUMN1, COLUMN2 FROM SOURCE_TABLE WHERE COLUMN3 = 'CONSTANT'

The quotes around 'CONSTANT' are stripped off so that the Oracle stage that uses it receives:

SELECT COLUMN1, COLUMN2 FROM SOURCE_TABLE WHERE COLUMN3 = CONSTANT

The job subsequently aborts.

Is there a way to ensure that the single quotes are correctly passed to the Oracle stage?

Regards
Thomas
Thomas K
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Try "escaping" the quote characters.

Code: Select all

WHERE COLUMN3 = \'CONSTANT\'
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
tkozlows
Premium Member
Premium Member
Posts: 13
Joined: Tue Dec 03, 2002 7:31 pm
Location: Melbourne, Australia

Post by tkozlows »

Thank you Ray. Works fine.
Thomas K
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You could also use the 'new' APT variable that turns off the stripping... but I don't recall exactly what it is called at the moment. :(

Here you go:

http://www-304.ibm.com/support/docview. ... wg21386517
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply