we hava more than 1000 records. i have to select first 5
record, last 5 record and 5 records from middle of the source.
how can i do in oracle as well as in informetica??

Answers were Sorted based on User's Feedback



we hava more than 1000 records. i have to select first 5 record, last 5 record and 5 records from m..

Answer / babu

Hi All,

ORACLE:
========
Below SQL query will give the exact result of what you
people are expecting.

SELECT rownum num,e.* From Emp e Where Rownum<=5
Union
SELECT * From
(SELECT Rownum Num,E.* From Emp E)
Where Num BETWEEN (SELECT round(Count(*)/2) From Emp)AND
(SELECT round(Count(*)/2) +1 From Emp)
Union

SELECT * From
(SELECT rownum num,e.* From emp e)
Where Num <=(SELECT count(*) From Emp)
And
Num>(SELECT count(*)-5 From Emp)

INFORMATICA:
============
please find the below mapping for your scenario.

SRC==>SQ==>(1)EXP==>AGG=====JNR===>RTR==T1,T2,T3
|| ||
(2)EXP==========

1> In first expression having the all columns coming from
the source and two extra columns(output ports)
I.one for sequence numbers.
II.second one is for constant value
2> In aggregatation transformation count the number of
records based(GROUP BY)on the dummy port.
3> In joiner transformation join the two flows(AGG and Exp
the join column is dummy port)

4> create 3 groups in Router transformation for 1St 5
records,Latst 5 records and Middle 5 records

GRP1::sno<=5
GRP2::sno<=cno+2 and sno>=cno-2 /*cno=count(*)*/
GRP3::sno<=cno and sno>cno-5

Cheers,
Babu rao

Is This Answer Correct ?    3 Yes 1 No

we hava more than 1000 records. i have to select first 5 record, last 5 record and 5 records from m..

Answer / babu

Hi Guys,
small change is there in above solution

i.e:: GRP2:sno<=(cno/2)+2 AND sno>=(cno/2)-2




Cheers,
Babu Rao

Is This Answer Correct ?    0 Yes 0 No

we hava more than 1000 records. i have to select first 5 record, last 5 record and 5 records from m..

Answer / chanukya

have the sequence generator transformation in the mapping
whcih will give you the row numbers.

From there you can take watever rows you want. From 1 to
last or anything.

This wil help you.

Is This Answer Correct ?    2 Yes 5 No

we hava more than 1000 records. i have to select first 5 record, last 5 record and 5 records from m..

Answer / akash

For implementation through Oracle:
Sort ASC/DESC on rowid in a sub-query and take first 5 rows
of this query in main query.

For implementation through informatica:
1. Use Rank Transformation.
2. Use Sorter Transformation.

The above are for first or last 5 records. Middle 5 records
are not included here.

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More ETL Interview Questions

what are Lookup caches options? Including persistent caches.

0 Answers  


can u anyone plz share some etl testing interview question . and share the sql queries and unix . plz help me to clear in the etl testing interview by sharing ur knowledge

0 Answers   Cap Gemini,


when should one create lookup transformation ?

2 Answers  


Hi my name is kuldeep singh, i have finished my B.E in computer science and engg in 2008. I have worked with accenture for 17 months and because of family problem i left the job in dec 2009.. i was in data ware housing capability. right now i am working in a BPO as technicla support executive,, i want to move to IT again, please suggest me what shuld i do? its been 1 year gap and i am not able to get into IT...please suggest me ...should i go for informatica certification will that help me to get inot IT. please give ur suggestion..my E mail is is singh.kuldeep2004@yahoo.in

0 Answers  


Can there be sub steps of etl steps?

0 Answers  






what is the use of server?

0 Answers  


working of line item dimension......pls,tell overall flow

1 Answers  


how do u set partition points in the mapping?

0 Answers  


what are the reports created in mm and sd side using sap bw in a project? name some of them and explain the requirement?

0 Answers   Accenture,


Explain about hash partitioning?

0 Answers  


Is apache nifi an etl tool?

0 Answers  


what are the facilities provided by data warehouse to analytical users?

0 Answers  


Categories