Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

11/29/2018 Informatica Scenario Based Questions - Part 5

Home Data Warehouse Informatica Informatica Scenarios Informatica Cloud Oracle Unix Hadoop

Search... Search
Informatica Scenario Based Questions - Part 5
Q1. The source data contains only column 'id'. It will have sequence numbers from 1 to 1000.
Popular Posts
The source data looks like as Informatica Scenario Based Interview Questions with
Answers - Part 1
Id
1 Unix Sed Command to Delete Lines in File - 15 Examples
2
String Functions in Hive
3
4 Top Examples of Awk Command in Unix
5
6 Sed Command in Unix and Linux Examples
7
Design/Implement/Create SCD Type 2 Effective Date
8
Mapping in Informatica
....
1000 Date Functions in Hive

SQL Queries Interview Questions - Oracle Part 1


Create a workflow to load only the Fibonacci numbers in the target table. The target table data
should look like as Top Unix Interview Questions - Part 1

Id Update Strategy Transformation in Informatica


1
2
Have Questions? Follow Me
3
5
8
13
.....

https://www.folkstalk.com/2011/11/informatica-scenario-based-questions.html 1/11
11/29/2018 Informatica Scenario Based Questions - Part 5

vijay bhaskar
In Fibonacci series each subsequent number is the sum of previous two numbers. Here assume Add to circles
that the first two numbers of the fibonacci series are 1 and 2.

Solution:

STEP1: Drag the source to the mapping designer and then in the Source Qualifier
Transformation properties, set the number of sorted ports to one. This will sort the source data in
ascending order. So that we will get the numbers in sequence as 1, 2, 3, ....1000

STEP2: Connect the Source Qualifier Transformation to the Expression Transformation. In the
Expression Transformation, create three variable ports and one output port. Assign the
expressions to the ports as shown below.

Ports in Expression Transformation:


id
994 have me in circles View all
v_sum = v_prev_val1 + v_prev_val2
v_prev_val1 = IIF(id=1 or id=2,1, IIF(v_sum = id, v_prev_val2, v_prev_val1) )
v_prev_val2 = IIF(id=1 or id =2, 2, IIF(v_sum=id, v_sum, v_prev_val2) )
o_flag = IIF(id=1 or id=2,1, IIF( v_sum=id,1,0) )

STEP3: Now connect the Expression Transformation to the Filter Transformation and specify the
Filter Condition as o_flag=1

STEP4: Connect the Filter Transformation to the Target Table.

Q2. The source table contains two columns "id" and "val". The source data looks like as below

id val
1 a,b,c
2 pq,m,n
3 asz,ro,liqt

Here the "val" column contains comma delimited data and has three fields in that column.
Create a workflow to split the fields in “val” column to separate rows. The output should look like
as below.

https://www.folkstalk.com/2011/11/informatica-scenario-based-questions.html 2/11
11/29/2018 Informatica Scenario Based Questions - Part 5

id val
1 a
1 b
1 c
2 pq
2 m
2 n
3 asz
3 ro
3 liqt

Solution:

STEP1: Connect three Source Qualifier transformations to the Source Definition

STEP2: Now connect all the three Source Qualifier transformations to the Union Transformation.
Then connect the Union Transformation to the Sorter Transformation. In the sorter
transformation sort the data based on Id port in ascending order.

STEP3: Pass the output of Sorter Transformation to the Expression Transformation. The ports in
Expression Transformation are:

id (input/output port)
val (input port)
v_currend_id (variable port) = id
v_count (variable port) = IIF(v_current_id!=v_previous_id,1,v_count+1)
v_previous_id (variable port) = id
o_val (output port) = DECODE(v_count, 1,
SUBSTR(val, 1, INSTR(val,',',1,1)-1 ),
2,
SUBSTR(val, INSTR(val,',',1,1)+1, INSTR(val,',',1,2)-INSTR(val,',',1,1)-1),
3,
SUBSTR(val, INSTR(val,',',1,2)+1),
NULL
)

STEP4: Now pass the output of Expression Transformation to the Target definition. Connect id,
o_val ports of Expression Transformation to the id, val ports of Target Definition.
https://www.folkstalk.com/2011/11/informatica-scenario-based-questions.html 3/11
11/29/2018 Informatica Scenario Based Questions - Part 5

For those who are interested to solve this problem in oracle sql, Click Here. The oracle sql query
provides a dynamic solution where the "val" column can have varying number of fields in each
row.

For more scenario based questions visit


Part1
Part2
Part3
Part4
Part5

If you like this post, please share it by clicking on +1 Button.

27 comments:

karthick 23 November, 2011 21:50


very nice
Reply

Krishna Rao 24 November, 2011 08:16


Superb sir. u have done gud job. explanation gives simple to understand. Thanks
Reply

Anonymous 25 November, 2011 03:27


Hi, thanks for all your excellent work...I learn alot!
But I am not able to understand the first question's ans, Which port is the final port that need to be
connected to target for the desired result?
Reply

smile 25 November, 2011 04:48


Connect id and o_val ports from expression transformation to the target
https://www.folkstalk.com/2011/11/informatica-scenario-based-questions.html 4/11
11/29/2018 Informatica Scenario Based Questions - Part 5

Reply

Anonymous 05 December, 2011 01:00


simply superb job gentlemen...hatsoff
Reply

Infguy 06 December, 2011 07:00


Can u Solve this plz

source

Rama
rajesh
anu
sonu
suryanarayana

Target
Rama*********
rajesh*******
anu*********
sonu*********
suryanarayana
Reply

Replies

HANUMANTHARAO 08 November, 2013 02:12


BY USING STORED PROCEDURE TRANSFORMATION IT IS POSSIBLE.
look at this logic

create or replace procedure string_lpad(name in varchar2,out_name out varchar2) is


v_max number;
begin
select max(length(name)) into v_max from source_tab_name;
out_name:=rpad(name,v_max,'*');
end;

Reply

https://www.folkstalk.com/2011/11/informatica-scenario-based-questions.html 5/11
11/29/2018 Informatica Scenario Based Questions - Part 5

smile 06 December, 2011 08:45


@infguy,
What i understood from the question is you need the output as a 13 character string. If the input
string has less than 13 characters, then you want to add * at the end of the string.

If my assumption is correct, then it is very easy to solve using expression transformation.

Create an output port in expression transformation and then assign the expression
rpad(string,13,'*')

If this is not what you want, then please clearly explain your problem
Reply

infguy 06 December, 2011 08:56


@smile

Thanks

yes exactly i want to put * if the string is less than the highest string length in source but how can
v know the highest one is 13 i mean if v dont know the highest size(if v hv millions in source)
Reply

infguy 06 December, 2011 09:02


can u explain me the solution step by step
Reply

smile 06 December, 2011 20:55


@infguy

One thing you can do is write the length of the maximum length of the string in a parameter file in
one session.
SELECT max(length(string)) from table_name;

In the other session read the parameter value in expression transformation.

I never tried this one. I hope it will work for you.


https://www.folkstalk.com/2011/11/informatica-scenario-based-questions.html 6/11
11/29/2018 Informatica Scenario Based Questions - Part 5

Reply

infguy 26 December, 2011 22:49


Hi

I am having a problem

i am passing dept table to router and giving three conditions to three groups
deptno=10,deptno=20,deptno=30

requirement is if first group condition is satisfied i dnt want to run remaining groups or they should
fail

can u help me in this


Reply

vijay bhaskar 26 December, 2011 23:12


@infguy

If you get detpno=10 in the input, then other two group conditions will definitely fail.
Reply

vijay bhaskar 26 December, 2011 23:14


This comment has been removed by the author.
Reply

vijay bhaskar 26 December, 2011 23:15


How router transformation works is, it will check all the group conditions and if they pass, then it
pass the corresponding group data to the downstream transformations.

For example if you specify three group conditions as deptno<=10, deptno<=20, deptno<=30.
When you get deptno=15 as input, then the 2nd and 3rd groups will satisfy.
Reply

https://www.folkstalk.com/2011/11/informatica-scenario-based-questions.html 7/11
11/29/2018 Informatica Scenario Based Questions - Part 5

infguy 27 December, 2011 05:31


@vijay bhaskar

Thanks for ur reply i understand the router functionality but my scenario is whenever the first
group condition( say deptno=10) satisfied the remaining group conditions( if any) should fail.
Reply

vijay bhaskar 27 December, 2011 07:07


@infguy

In your scenario, the other two group conditions will fail.


Reply

infguy 28 December, 2011 10:40


@ vijay bhaskar

wht should be the condition in 2 group to fail it


Reply

vijay bhaskar 28 December, 2011 21:06


If you want to fail the other groups always, use some department number which is not in the
database at all. something like deptno=999999999
Reply

infguy() 30 January, 2012 03:20


Hi

source is
abc
count
and the target should load as
abc
abc
.
.

https://www.folkstalk.com/2011/11/informatica-scenario-based-questions.html 8/11
11/29/2018 Informatica Scenario Based Questions - Part 5

count times

if the count is 10 then i want to load abc 10 times

Can u help me doing this


Reply

Replies

vijay bhaskar 30 January, 2012 04:26


In informatica i am not sure how to do this. May be you have to use java
transformation. You can implement this suing a procedure. If you are using oracle data
base, please go through the link Query to duplicate column data

Karun Y 12 April, 2013 03:56


As per my knoledge on Informatica there are multiple solutions...

1. If you know the max count then using normalizer you can achieve it.
2. If you don't know the max count then...
2a. Use SQL transformation. OR
2b. Use Stored Procedure transformation.
2c. Use Java transformation.

Let me know if you need detailed solutions for it. (Contact me @ karun4all@gmail.com

Hope this gives you some idea, thank you. -- Karun

Reply

Anonymous 09 February, 2012 22:59


Your Explanation is really awasome

Thaks
Rajneesh
Reply

Unknown 27 March, 2012 15:31

https://www.folkstalk.com/2011/11/informatica-scenario-based-questions.html 9/11
11/29/2018 Informatica Scenario Based Questions - Part 5

Your Scenerios and the explanation is really amazing and so helpful... The scenerios help
understand the transformations and their properities even more...
If possible please post some more scenerios as well
Much appereciated!
Cheers!
Manasvini
Reply

Prafull Dangore 05 June, 2012 07:59


For q1...
Out_put = DECODE(NO_VALUE,1,1,2,2,Prev_No + PRE_PREV_NO)
PRE_PREV_NO = Prev_No
Prev_No = Out_put
Reply

Prafull Dangore 05 June, 2012 08:02


Out_put := DECODE(NO_VALUE,1,1,2,2,Prev_No + PRE_PREV_NO)
PRE_PREV_NO := Prev_No
Prev_No := Out_put
Reply

Mohammed Ali 06 January, 2014 00:36


Generate Fibonacci Series:

Ports in Expression Transformation:

ID
V_FIB1 = IIF(ID<3, ID, V_FIB2)
V_FIB2 = MOVINGSUM(V_FIB1, 2)
O_Fibonacci_Num

Connect Expression transformation's output port (ID & O_Fibonacci_Num) to the Filter
transformation.

Condition: ID>10

Note: Use Filter when you want to print the Fibonacci number till the specific ID number (eg. 10)
else you can directly connect Expression transformation's output to Target.

https://www.folkstalk.com/2011/11/informatica-scenario-based-questions.html 10/11
11/29/2018 Informatica Scenario Based Questions - Part 5

Hope this will help.


Reply

Enter your comment...

Comment as: Google Accoun

Publish Preview

Newer Post Home Older Post

Subscribe to: Post Comments (Atom)

https://www.folkstalk.com/2011/11/informatica-scenario-based-questions.html 11/11

You might also like