This website uses cookies. By continuing to browse the site, you are agreeing to our use of cookies
Data & AI Solutions
February 21, 2013
We generate Surrogate Key in DW environment to maintain history and we need a key other than Primary Key to uniquely identify the record. Example: If EMPNO is the key, we can keep only one record in target for the same Employee number and can’t maintain history, so we use Surrogate key as Primary key and not EMPNO.
The Sequence Generator transformation provides two output ports: NEXTVAL and CURRVAL. We cannot edit or delete these ports. Likewise, we cannot add ports to the transformation.
We can make a Sequence Generator reusable, and use it in multiple mappings. We might reuse a Sequence Generator when we perform multiple loads to a single target.
For example, if we have a large input file that we separate into three sessions running in parallel, we can use a Sequence Generator to generate primary key values. If we use different Sequence Generators, the Informatica Server might accidentally generate duplicate key values. Instead, we can use the same reusable Sequence Generator for all three sessions to provide a unique value for each target row.
Maximum value of the Sequence Generator is 9,223,372,036,854,775,807. If the Integration Service reaches this value during the session and the sequence is not configured to cycle, the session fails.
There are other alternate methods used in place of a Sequence Generator Transformation, especially when we want to build some pattern for the unique id generation. Be aware that most of the time these alternate methods work when the target is updated by one session at a time. If multiple sessions were adding records and running concurrently, this option doesn’t work.
Following are some of the alternate ways
Create one variable port and one output port as follows.
v_temp: v_temp+1
o_seq : v_temp
Sample mapping by using Expression Transformation:
Output of the target table to get sequence values using Expression Transformation:
For the incremental load the sequence number need to be generated based on existing max sequence number in target, at that time use lookup to pick max from target and use that in exp as per requirement.
Add rownum port to source qualifier and connected to empno again. Then generate own query like “select rownum, all columns from table”.
Sample mapping by using Source Qualifier Transformation:
Output of the target table to get sequence values using Source Qualifier Transformation:
Sample mapping by using connected Look up Transformation:
Output of the target table to get sequence values using Connected Look up Transformation:
Sample mapping by using Unconnected Look up Transformation:
Output of the target table to get sequence values using Unconnected Look up Transformation:
Thanks for reading; let us know have you followed other methods for unique sequence id generation in Informatica.
– By Muralidhar Reddy P & Niveditha N V
Every outcome starts with a conversation