How to pass Parameters to user defined sql queries

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
Nripendra Chand
Premium Member
Premium Member
Posts: 196
Joined: Tue Nov 23, 2004 11:50 pm
Location: Sydney (Australia)

How to pass Parameters to user defined sql queries

Post by Nripendra Chand »

Hi All,

How can we pass parameters to user defined sql in ODBC stage?

-Nripendra
Nripendra Chand
Premium Member
Premium Member
Posts: 196
Joined: Tue Nov 23, 2004 11:50 pm
Location: Sydney (Australia)

I want to use DECODE function

Post by Nripendra Chand »

Hi All,

i want to use DECODE function in my user query but this function is not taking parameter's corresponding value. So should i use procedures?

-Nripendra Chand
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

You can use a job parameter within a SQL stage by adding the parameter name surrounded by # symbols directly into user-defined SQL or condition fields.

Why do a DECODE in the database stage when you can do it in DataStage? DECODE is specific to Oracle so I assume you are trying to run it against an Oracle database. You might have more luck using it in the Oracle OCI stage or the Dynamic RDBMS stage instead of the ODBC stage. Personally I don't like using transformation functions in the select list of a database stage as it is not visible to the data lineage reporting functions in DataStage and MetaStage. Better to bring the column through in its rawest form and transform it in DataStage.
talk2shaanc
Charter Member
Charter Member
Posts: 199
Joined: Tue Jan 18, 2005 2:50 am
Location: India

Post by talk2shaanc »

Hi Nripendra,
Using of job parameters in a decode statement wont throw any error. I feel that your are not calling the parameter properly.
say I have declared a parameter, DeleteFlag with Default value as 'Y' then my sql will look like:

select decode(col1,#DeleteFlag#,'YES','NO') from <table_name>
Nripendra Chand
Premium Member
Premium Member
Posts: 196
Joined: Tue Nov 23, 2004 11:50 pm
Location: Sydney (Australia)

Post by Nripendra Chand »

Thanks a lot. I got it.

-Nripendra
Post Reply