How to retrieve the alternative records from each department

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
DWH-M
Premium Member
Premium Member
Posts: 46
Joined: Thu Sep 06, 2007 5:26 am

How to retrieve the alternative records from each department

Post by DWH-M »

HI

I have a source table that contains the different kind of the 10 departments information is available.

I need to retrieve and load the alternative records from the each department.


EX OF DATA: employee table contains the different departments like, savings department,current department,fixed department

each department having 100 records, i want retrive the alternative records from each department.



could any one help me the logic to implement.

thanx in advance
Suma
Last edited by DWH-M on Mon Apr 18, 2011 3:53 am, edited 1 time in total.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Show us examples of your input and your desired output.
-craig

"You can never have too many knives" -- Logan Nine Fingers
GJ_Stage
Participant
Posts: 131
Joined: Mon Oct 27, 2008 6:59 am

Post by GJ_Stage »

Assume you have department called : savings department

Hope your input and output as below:

Input:-

Emp name Emp Sal
A 10
B 20
C 292
D 99

Output:-

Emp name Emp Sal
A 10
C 292

If so, you can use below logic:-


Oracle stage ---> Transformer---> DS

In Transformer just add one sequence number for all the records
something like that :

Emp name Emp Sal Record number
A 10 1
B 20 2
C 292 3
D 99 4

Assign this to DS.

Use Another job or in the same job - to read DS and then use Transformer

Keep this constrint :
Mod(Record_number, 2) = 1

Now you will get only alternative records:

Something like this:

Emp name Emp Sal
A 10
C 292
Jothi
soumya5891
Participant
Posts: 152
Joined: Mon Mar 07, 2011 6:16 am

Post by soumya5891 »

When you are extracting from table use rownum function and group by department,and create the recordset.

Now from this recordset select those records where rownum is odd.You can do it by writing a sql statement
Soumya
Post Reply