1

We have a requirement where we have to Implement Insert, Update and delete Logic under the Same Mapping In Informatica. The Source and target table structures are the same and there is no difference. There is no primary key in the target and we are Defining PERSON_KEY as the primary key in the Informatica mapping to update records, I am currently using a look upon the target table and comparing the records and in the router transformation, The Following logic is used for insert and Updates. I have also provided the Table structure for reference.

NOTE: The Source and target are from Different Database

INSERT : ISNULL(LKP_PERSON_KEY)
UPDATE : IIF(PERSON_KEY=LKP_PERSON_KEY,TRUE,FALSE)

PERSON_KEY      NUMBER(7, 0) ,
SOURCE_CD       VARCHAR2(16 CHAR) ,
SOURCE_INSTANCE NUMBER(2, 0) ,
TYPE_CD         VARCHAR2(32 BYTE) ,
TYPE_INSTANCE   NUMBER(2, 0) ,
VALUE           VARCHAR2(255 CHAR) ,
VALUE_TEXT      VARCHAR2(255 CHAR) ,
UPDATE_SOURCE   VARCHAR2(32 CHAR) ,
UPDATE_ACCOUNT  VARCHAR2(32 CHAR) ,
UPDATE_DATETIME DATE ,
UPDATE_SUNETID  VARCHAR2(64 CHAR) ,
UPDATE_COMMENT  VARCHAR2(255 CHAR)

1 Answer 1

1

use update strategy.

Make sure PERSON_KEY is defined as PK in target designer.
Then in the mapping, right before target, add expression transformation. Pull in all data columns and PERSON_KEY,LKP_PERSON_KEY columns. Create a column with below logic. I assumed, if none of above condition met, delete the data.

out_insert_update_flag = 
IIF(ISNULL(LKP_PERSON_KEY), 'INSERT',IIF(PERSON_KEY=LKP_PERSON_KEY,'UPDATE','DELETE')
)

Then add the update strategy between expression transformation and target. Pull in all required columns and out_insert_update_flag. And create a logic like this-

IIF(out_insert_update_flag ='INSERT', DD_INSERT, IIF(out_insert_update_flag='UPDATE', DD_UPDATE, DD_DELETE
)) 

Then add all required columns to target.

In session - pls set load strategy to data driven.

Mapping should look like -

.... --> EXP-->UPD-->TGT
Sign up to request clarification or add additional context in comments.

2 Comments

I usually use a router to split INSERT/UPDATE/DELETE pipelines and use three target instances named accordingly. While technically there is no difference to this solution discussed by Koushik, it has following advantages: UPDATE strategy condition is plain and simple (each one uses just DD_INSERT/DD_UPDATE/DD_DELETE), it's clearly visible in the mapping what is going on and (last but not least) in the Monitor stats you can clearly see number of performed inserts/updates/deletes.
thats also a good idea @Maciejg...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.