Page 1 of 1

How to retrieve the alternative records from each department

Posted: Sun Apr 17, 2011 2:59 am
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

Posted: Sun Apr 17, 2011 7:29 am
by chulett
Show us examples of your input and your desired output.

Posted: Mon Apr 18, 2011 4:21 am
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

Posted: Tue Apr 19, 2011 11:07 am
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