Database Reference
In-Depth Information
Ports of the Sequence Generator transformation
The Sequence Generator transformation has only two ports, NEXTVAL and CURRVAL .
Both the ports are output ports. You cannot add or delete any port in a sequence generator.
It is recommended that you always use the NEXTVAL port first. If the NEXTVAL port is
utilized, then use the CURRVAL port. You can define the value of CURRVAL in the proper-
ties of the Sequence Generator transformation.
Consider a scenario where we are passing two records to the transformation. The following
events occur inside the Sequence Generator transformation. Also note that in our case, we
have defined the start value as 0 , the increment by value as 1 , and the end value is the de-
fault in the property. Also, the current value defined in Properties is 1 . The following is
the sequence of events:
1. When the first record enters the target from the filter transformation, the current
value, which is set to 1 in the Properties of the sequence generator, is assigned to
the NEXTVAL port. This gets loaded into the target by the connected link. So for
the first record, SEQUENCE_NO in the target is given the value of 1 .
2. The sequence generator increments CURRVAL internally and assigns that value to
the current value, 2 in this case.
3. When the second record enters the target, the current value that is set as 2 now gets
assigned to NEXTVAL . The sequence generator gets incremented internally to give
CURRVAL a value of 3 .
So at the end of the processing of record 2 , the NEXTVAL port will have a value of 2 and
the CURRVAL port will have its value set as 3 . This is how the cycle keeps on running till
you reach the end of the records from the source.
It is slightly confusing to understand how the NEXTVAL and CURRVAL ports behave, but
after reading the given example, you will have a proper understanding of the process.
Search WWH ::




Custom Search