Which stage can be used to run this query from Data Stage

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
John Daniel
Participant
Posts: 42
Joined: Mon Oct 15, 2007 10:35 pm
Location: Charlotte
Contact:

Which stage can be used to run this query from Data Stage

Post by John Daniel »

Hi DS Guru's,

Have a challenge to run this below given query .

Please help me which stage can be used to run the query ?
If possible ...How to implement it in design.

Query:

variable b1 VARCHAR2(40);
variable b2 VARCHAR2(40);

exec :b1 := '#$START_DATE#'
exec :b2 := '#$END_DATE#'

select
T1.ROW_ID AS PRIMARY_ID,
T3.ROW_ID AS MID_ID,
'SECDSBL43' AS TYPE_CD
FROM
SIEBEL.S_EVT_ACT T1,
SIEBEL.S_CONTACT T2,
SIEBEL.S_ACT_EMP T3
WHERE
T1.EVT_STAT_CD IN ('Done', 'Closed')
and T1.X_RECORD_TYPE = 'Sales'
AND T1.ROW_ID = T3.ACTIVITY_ID
AND T2.ROW_ID = T3.EMP_ID
and T2.EMP_FLG = 'Y'
and (((T3.LAST_UPD) > TO_DATE (:b1,'YYYY-MM-DD HH24:MI:SS') and T3.LAST_UPD) <= TO_DATE (:b2,'YYYY-MM-DD HH24:MI:SS'))
or ((T1.LAST_UPD) > TO_DATE (:b1,'YYYY-MM-DD HH24:MI:SS') and (T1.LAST_UPD) <= TO_DATE (:b2,'YYYY-MM-DD HH24:MI:SS')))


Looking for your kind help in this.

Thanks,
John
kandyshandy
Participant
Posts: 597
Joined: Fri Apr 29, 2005 6:19 am
Location: Singapore

Post by kandyshandy »

1. Define required date parameters in a job.
2. Select the DB stage that suits your DB, fill-in credentials & use your SQL;
Pass the parameters defined in step 1 to the WHERE clause.
3. Write the output to file

;)
Kandy
_________________
Try and Try again…You will succeed atlast!!
grimm336
Participant
Posts: 12
Joined: Thu Jun 25, 2009 10:19 am

Re: Which stage can be used to run this query from Data Stag

Post by grimm336 »

As suggested define the parameters in the job properties and use API stages to read from the table and write into a file.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Not sure where the "write it to a file" part is coming from but the other advice is solid. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
John Daniel
Participant
Posts: 42
Joined: Mon Oct 15, 2007 10:35 pm
Location: Charlotte
Contact:

Which stage can be used to run this query from Data Stage

Post by John Daniel »

Defined project level parameters...

I can get the values from parameters...Want to execute....that entire query

Advice me which stage support to run the query....

Let me know if I'm not clear to you !!
Thanks,
John
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You CAN execute the query. You don't need variable declarations or initialization within the query - you use job parameters for these.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Re: Which stage can be used to run this query from Data Stag

Post by qt_ky »

John Daniel wrote:Advice me which stage support to run the query....
Which stage to use depends upon which database you have. If it's Oracle, try the Oracle Connector stage.
Choose a job you love, and you will never have to work a day in your life. - Confucius
Post Reply