Please subscribe on my
YouTube Channel.
There could multiple reasons as to why the Variable is not getting set as expected.
In my scenario, My SQL override didn't pick any data to be loaded to the target table.
The SETVARIABLE function executes only if a row is marked as insert or update. SETVARIABLE ignores all other row types and the current value remains unchanged.
At the end
of a successful session, the
PowerCenter
Integration Service compares the final current value of the variable to
the start value of the variable.
The
PowerCenter
Integration Service does not save the final value of a mapping variable
to the repository when any of the following conditions are true:
-
The session
fails to complete.
-
The session
is configured for a test load.
-
The session
is a debug session.
-
The session
runs in debug mode and is configured to discard session output.
If you always want your variable to be set after every run then the workaround I used it to do a union of your SQL override with dummy data row, implies you will always have at least one row to be inserted in the target table.
you later can delete this extra row using post-session SQL.
select col1, col2 from yourTargetTable where conditionThatDoesntReturnAnyRow=0
union
select 'dummy1','dummy2'