Sunday, 31 January 2016

Informatica Interview Questions



1.What are the differences between Connected and Unconnected Lookup?

The differences are illustrated in the below table:

Connected LookupUnconnected Lookup
Connected lookup participates in dataflow and receives input directly from the pipelineUnconnected lookup receives input values from the result of a LKP: expression in another transformation
Connected lookup can use both dynamic and static cacheUnconnected Lookup cache can NOT be dynamic
Connected lookup can return more than one column value ( output port )Unconnected Lookup can return only one column value i.e. output port
Connected lookup caches all lookup columnsUnconnected lookup caches only the lookup output ports in the lookup conditions and the return port
Supports user-defined default values (i.e. value to return when lookup conditions are not satisfied)Does not support user defined default values

2.What is meant by active and passive transformation?

An active transformation is the one that performs any of the following actions:

  1. Change the number of rows between transformation input and output. Example: Filter transformation
  2. Change the transaction boundary by defining commit or rollback points., example transaction control transformation
  3. Change the row type, example Update strategy is active because it flags the rows for insert, delete, update or reject

On the other hand a passive transformation is the one which does not change the number of rows that pass through it. Example: Expression transformation.

3.Why is Sorter an Active Transformation?
This is because we can select the "distinct" option in the sorter property.

When the Sorter transformation is configured to treat output rows as distinct, it assigns all ports as part of the sort key. The Integration Service discards duplicate rows compared during the sort operation. The number of Input Rows will vary as compared with the Output rows and hence it is an Active transformation

4.What are the new features of Informatica 9.x in developer level?

From a developer's perspective, some of the new features in Informatica 9.x are as follows:

  • Now Lookup can be configured as an active transformation – it can return multiple rows on successful match
  • Now you can write SQL override on un-cached lookup also. Previously you could do it only on cached lookup
  • You can control the size of your session log. In a real-time environment you can control the session log file size or time
  • Database deadlock resilience feature – this will ensure that your session does not immediately fail if it encounters any database deadlock, it will now retry the operation again. You can configure number of retry attempts.

Revisiting Rank Transformation

Q5. What is a Rank Transform?

Ans. Rank is an Active Connected Informatica transformation used to select a set of top or bottom values of data.

6. How does a Rank Transform differ from Aggregator Transform functions MAX and MIN?

Ans. Like the Aggregator transformation, the Rank transformation lets us group information. The Rank Transform allows us to select a group of top or bottom values, not just one value as in case of Aggregator MAX, MIN functions.

7. What is a RANK port and RANKINDEX?

Ans. Rank port is an input/output port use to specify the column for which we want to rank the source values. By default Informatica creates an output port RANKINDEX for each Rank transformation. It stores the ranking position for each row in a group.

8. How can you get ranks based on different groups?

Ans. Rank transformation lets us group information. We can configure one of its input/output ports as a group by port. For each unique value in the group port, the transformation creates a group of rows falling within the rank definition (top or bottom, and a particular number in each rank).

9. What happens if two rank values match?

Ans. If two rank values match, they receive the same value in the rank index and the transformation skips the next value.

10. What are the restrictions of Rank Transformation?

Ans.

  • We can connect ports from only one transformation to the Rank transformation.
  • We can select the top or bottom rank.
  • We need to select the Number of records in each rank.
  • We can designate only one Rank port in a Rank transformation.

11. How does a Rank Cache works?

Ans. During a session, the Integration Service compares an input row with rows in the data cache. If the input row out-ranks a cached row, the Integration Service replaces the cached row with the input row. If we configure the Rank transformation to rank based on different groups, the Integration Service ranks incrementally for each group it finds. The Integration Service creates an index cache to stores the group information and data cache for the row data.

12. How does Rank transformation handle string values?

Ans. Rank transformation can return the strings at the top or the bottom of a session sort order. When the Integration Service runs in Unicode mode, it sorts character data in the session using the selected sort order associated with the Code Page of IS which may be French, German, etc. When the Integration Service runs in ASCII mode, it ignores this setting and uses a binary sort order to sort character data.

Revisiting Sorter Transformation

13. What is a Sorter Transformation?

Ans. Sorter Transformation is an Active, Connected Informatica transformation used to sort data in ascending or descending order according to specified sort keys. The Sorter transformation contains only input/output ports.

14. Why is Sorter an Active Transformation?

Ans. When the Sorter transformation is configured to treat output rows as distinct, it assigns all ports as part of the sort key. The Integration Service discards duplicate rows compared during the sort operation. The number of Input Rows will vary as compared with the Output rows and hence it is an Active transformation.

15. How does Sorter handle Case Sensitive sorting?

Ans. The Case Sensitive property determines whether the Integration Service considers case when sorting data. When we enable the Case Sensitive property, the Integration Service sorts uppercase characters higher than lowercase characters.

16. How does Sorter handle NULL values?

Ans. We can configure the way the Sorter transformation treats null values. Enable the property Null Treated Low if we want to treat null values as lower than any other value when it performs the sort operation. Disable this option if we want the Integration Service to treat null values as higher than any other value.

17. How does a Sorter Cache works?

Ans. The Integration Service passes all incoming data into the Sorter Cache before Sorter transformation performs the sort operation.

The Integration Service uses the Sorter Cache Size property to determine the maximum amount of memory it can allocate to perform the sort operation. If it cannot allocate enough memory, the Integration Service fails the session. For best performance, configure Sorter cache size with a value less than or equal to the amount of available physical RAM on the Integration Service machine.

If the amount of incoming data is greater than the amount of Sorter cache size, the Integration Service temporarily stores data in the Sorter transformation work directory. The Integration Service requires disk space of at least twice the amount of incoming data when storing data in the work directory.

Friday, 29 January 2016

Oracle Date Functions and Operators.


Date Functions and Operators.

To see the system date and time use the following functions :

CURRENT_DATE    :returns the current date in the session time zone, in a value in the Gregorian calendar of datatype 
                                   DATE
SYSDATE                 :Returns the current date and time. 
SYSTIMESTAMP    :The SYSTIMESTAMP function returns the system date, including fractional seconds and time zone 
                                    of the database. The return type is TIMESTAMP WITH TIME ZONE.

SYSDATE Example

To see the current system date and time give the following query.

select sysdate from dual;

SYSDATE
-------
8-AUG-03

The format in which the date is displayed depends on NLS_DATE_FORMAT parameter.

For example set the NLS_DATE_FORMAT to the following format

alter session set NLS_DATE_FORMAT='DD-MON-YYYY HH:MIpm';

Then give the give the following statement

select sysdate from dual;

SYSDATE
------------------
8-AUG-2003 03:05pm

The default setting of NLS_DATE_FORMAT is DD-MON-YY


CURRENT_DATE Example

To see the current system date and time with  time zone use CURRENT_DATE function

ALTER SESSION SET TIME_ZONE = '-4:0';
ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY HH24:MI:SS';
SELECT SESSIONTIMEZONE, CURRENT_DATE FROM DUAL;

SESSIONTIMEZONE CURRENT_DATE
--------------- --------------------
-04:00          22-APR-2003 14:15:03

ALTER SESSION SET TIME_ZONE = '-7:0';
SELECT SESSIONTIMEZONE, CURRENT_DATE FROM DUAL;

SESSIONTIMEZONE CURRENT_DATE
--------------- --------------------
-07:00          22-APR-2003 09:15:33

 

SYSTIMESTAMP Example

To see the current system date and time with fractional seconds with time zone give the following statement

select systimestamp from dual;

SYSTIMESTAMP
-------------------------------
22-APR-03 08.38.55.538741 AM -07:00

 

DATE FORMAT MODELS

To translate the date into a different format string  you can use TO_CHAR function with date format. For example to see the current day you can give the following query

Select to_char(sysdate,'DAY')"Today" FROM DUAL;

TODAY
-------
THURSDAY

To translate a character value, which is in format other than the default date format, into a date value you can use TO_DATE function with date format to date

Like this "DAY" format model there are many other date format models available in Oracle. The following table list date format models.

FORMAT

MEANING

D

Day of the week

DD

Day of the month

DDD

Day of the year

DAY

Full day for ex. 'Monday', 'Tuesday', 'Wednesday'

DY

Day in three letters for ex. 'MON', 'TUE','FRI'

W

Week of the month

WW

Week of the year

MM

Month in two digits  (1-Jan, 2-Feb,…12-Dec)

MON

Month in three characters like "Jan", "Feb", "Apr"

MONTH

Full Month like "January", "February", "April"

RM

Month in Roman Characters (I-XII, I-Jan, II-Feb,…XII-Dec)

Q

Quarter of the Month

YY

Last two digits of the year.

YYYY

Full year

YEAR

Year in words like "Nineteen Ninety Nine"

HH

Hours in 12 hour format

HH12

Hours in 12 hour format

HH24

Hours in 24 hour format

MI

Minutes

SS

Seconds

FF

Fractional Seconds

SSSSS

Milliseconds

J

Julian Day i.e Days since 1st-Jan-4712BC to till-date

RR

If the year is less than 50 Assumes the year as 21ST Century. If the year is greater than 50 then assumes the year in 20th Century.

 

suffixes

TH

Returns th, st, rd or nd according to the leading number like 1st , 2nd 3rd 4th

SP

Spells out the leading number

AM or PM

Returns AM or PM according to the time

SPTH

Returns Spelled Ordinal number. For. Example First, Fourth

For example to see the today's date in the following format

Friday, 7th March, 2014 

Give the following statement

select to_char(sysdate,'Day, ddth Month, yyyy')"Today" from dual;

TODAY
------------------------
Friday, 7th March, 2014 

For example you want to see hire dates of all employee in the following format

Friday, 8th August, 2003 

Then give the following query.

select to_char(hire_date,'Day, ddth Month, yyyy') from emp;

 

TO_DATE Example

To_Date function is used to convert strings into date values. For example you want to see what was the day on 15-aug-1947. The use the to_date function to first convert the string into date value and then pass on this value to to_char function to extract day.

select to_char(to_date('15-aug-1947','dd-mon-yyyy'),'Day') 
                                         from dual;

TO_CHAR(
--------
Friday

To see how many days have passed since 15-aug-1947 then give the following query

select sysdate-to_date('15-aug-1947','dd-mon-yyyy') from dual;

Now we want to see which date will occur after 45 days from now

select sysdate+45 from dual;

SYSDATE
-------
06-JUN-2003


ADD_MONTHS

To see which date will occur after 6 months from now, we can use ADD_MONTHS function

Select ADD_MONTHS(SYSDATE,6) from dual;

ADD_MONTHS
----------
22-OCT-2003

 

MONTHS_BETWEEN

To see how many months have passed since  a particular date, use the MONTHS_BETWEEN function.

For Example, to see how many months have passed since 15-aug-1947, give the following query.

select months_between(sysdate,to_date('15-aug-1947')) 
                             from dual;

Months
------
616.553

To eliminate the decimal value use truncate function

select trunc(months_between(sysdate,to_date('15-aug-1947')))
                             from dual;

Months
------
616

 

LAST_DAY

To see the last date of the month of a given date, Use LAST_DAY function.

select LAST_DAY(sysdate) from dual;

LAST_DAY
--------
31-AUG-2003

 

NEXT_DAY

To see when a particular day is coming next ,  use the NEXT_DAY function.

For Example to view when next Saturday is coming, give the following query

select next_day(sysdate) from dual;

NEXT_DAY
-----------
09-AUG-2003

 

EXTRACT

An EXTRACT datetime function extracts and returns the value of a specified datetime field from a datetime or interval value expression. When you extract a TIMEZONE_REGION or TIMEZONE_ABBR (abbreviation), the value returned is a string containing the appropriate time zone name or abbreviation

The syntax of EXTRACT function is

EXTRACT ( YEAR / MONTH / WEEK / DAY / HOUR / MINUTE / TIMEZONE  FROM DATE)

Example
The following demonstrate the usage of EXTRACT function to extract year from current date.

select extract(year from sysdate) from dual;

EXTRACT
-------
2003

Thursday, 28 January 2016

View Dependencies


This post will help to get the underlying tables of the views . 


create view sample_V as select a.* from user_rep.opb_subject a inner join user_rep.opb_mapping b 
on a.subj_id=b.subject_id ;

select Name , type , referenced_name , referenced_type
from USER_dependencies where   type = 'VIEW' and
referenced_type = 'TABLE'    
 




Note : SysAdmin Login see the all the base tables of the view by referring  
dba_dependencies   (By using the filter on the column named owner )


The view 'USER_DEPENDENCIES' will give the dependencies of logged in user.
The view 'DBA_DEPENDENCIES' will give the dependencies of all the users.
 


--




Wednesday, 6 January 2016

Conditional Aggregate Functions in Informatica

Problem :


Data is coming in one field like

 

Amount(input)

-----------

1

2

13

-1

-2

-10

 

 

Want output like in two different columns in one table

 

Sum_positive      Sum_Negative

-------------------       ---------------------

16                        -13


Solution : 

Easier option would be to use the "conditional aggregate functions":

 

Set one output port "sum_positive" of the AGG to this expression:

  Sum( Amount, Amount > 0)

 

Set one output port "sum_negative" of the AGG to this expression:

  Sum( Amount, Amount < 0)