What is Sequence Generator Transformation?
Sequence generator transformation is passive so it does not affect the number of input rows. The sequence generator is used to generate primary key values & it’s used to generate numeric sequence values like 1, 2, 3, 4, 5 etc.
For example, you want to assign sequence values to the source records, then you can use sequence generator. The generated sequence values can be like 5, 10, 15, 20, 25 etc. or 10, 20, 30, 40, 50 etc. depending upon the configured properties of the transformation.
Sequence generator has two output ports
CURRVAL port value is always NEXTVAL+1.
To generate the sequence numbers, we always use the NEXTVAL column.
Properties of Sequence Generator Transformation
Start Value – It is the first value that will be generated by the transformation, the default value is 0.
Increment by – This is the number by which you want to increment the values. The default value is 1.
End value – It is the maximum value that the transformation should generate.
Cycle – if this option is set then after reaching the end of the value, the transformation restarts from the start value.
In this example, we will generate sequence numbers and store in the target.
Step 1 – Create a target table with the following script.
Step 2– Import the table in Informatica as target table
Step 3 – Create a new mapping and import EMP source and EMP_SEQUENCE target table
Step 4 – Create a new transformation in the mapping
Select sequence transformation as the type
Enter transformation name “seq_emp”
Select Create option
Step 5 – Sequence generator transformation will be created, select the done option
Step 6 – Link the NEXTVAL column of sequence generator to SNO column in target
Step 7 – link the other columns from source qualifier transformation to the target table
Step 8 – Double click on the sequence generator to open property window, and then
Select the properties tab
Enter the properties with Start value =1, leave the rest properties as default
Select OK button
Now save the mapping and execute it after creating the session and workflow.
The sno column in the target would contain the sequence numbers generated by the sequence generator transformation.
In our example, the sequences will be like 1 – Scott, 2 – King, 3 – Adam, 4 – Miller, etc.