behappyandmakeotherstobehappy:SCDType3
SCDType3
ThisMethodhaslimitedhistorypreservation,andwearegoannauseskeyasthePrimary
keyhere.
Sourcetable:(01012011)
Empno
Ename
Sal
101
1000
102
2000
103
3000
TargetTable:(01012011)
Empno Ename
Csal
Psal
101
1000
102
2000
103
3000
SourceTable:(01022011)
Empno
Ename
Sal
101
1000
102
4566
103
3000
TargetTable(01022011):
Empno
Ename
Csal
Psal
101
1000
102
4566
Null
103
3000
102
4544
4566
data:text/htmlcharset=utf8,%3Ch3%20class%3D%22posttitle%20entrytitle%22%20itemprop%3D%22name%22%20style%3D%22margin%3A%200px%3B%20position%3A%20relative%3B%20fontstyle%3A%20normal%3B
1/4
6/5/2015
behappyandmakeotherstobehappy:SCDType3
SohopeugotwhatImtryingtodowiththeabovetables:
Step1:InitiallyinthemappingdesignerImgoannacreateamappingasbelow.Andin
thismappingImusinglookup,expression,filter,updatestrategytodrivethepurpose.
ExplanationofeachandeveryTransformationisgivenbelow.
Step2:herewearegoannaseethepurposeandusageofallthetransformationsthatwe
haveusedintheabovemapping.
LookupTransformation:ThelookTransformationlooksthetargettableandcompares
thesamewiththesourcetable.BasedontheLookupconditionitdecideswhetherwe
needtoupdate,insert,anddeletethedatafrombeingloadedintothetargettable.
AsusuallywearegoannaconnectEmpnocolumnfromtheSourceQualifier
andconnectittolookuptransformation.PriortothisLookuptransformation
hastolookatthetargettable.
Nexttothiswearegoannaspecifythelookupconditionempno=empno1.
FinallyspecifythatconnectionInformation(Oracle)andlookuppolicyon
multiplemismatches(uselastvalue)inthePropertiestab.
ExpressionTransformation:
WeareusingtheExpressionTransformationtoseparateouttheInsertstuffsandUpdate
Stuffslogically.
DragalltheportsfromtheSourceQualifierandLookupintoExpression.
AddtwoPortsandRenamethemasInsert,Update.
Thesetwoportsaregoannabejustoutputports.Specifythebelowconditions
data:text/htmlcharset=utf8,%3Ch3%20class%3D%22posttitle%20entrytitle%22%20itemprop%3D%22name%22%20style%3D%22margin%3A%200px%3B%20position%3A%20relative%3B%20fontstyle%3A%20normal%3B
2/4
6/5/2015
behappyandmakeotherstobehappy:SCDType3
intheExpressioneditorfortheportsrespectively.
Insert:isnull(ENO1)
Update:iif(notisnull(ENO1)anddecode(SAL,Curr_Sal,1,0)=0,1,0)
FilterTransformation:WearegoannausetwofilterTransformationtofilteroutthedata
physicallyintotwoseparatesectionsoneforinsertandtheotherfortheupdateprocessto
happen.
Filter1:
DragtheInsertandotherthreeportswhichcamefromsourcequalifierintothe
Expressionintofirstfilter.
InthePropertiestabspecifytheFilterconditionasInsert.
Filter2:
DragtheupdateandotherfourportswhichcamefromLookupintothe
ExpressionintoSecondfilter.
InthePropertiestabspecifytheFilterconditionasupdate.
UpdateStrategy:Finallyweneedtheupdatestrategytoinsertortoupdateintothe
data:text/htmlcharset=utf8,%3Ch3%20class%3D%22posttitle%20entrytitle%22%20itemprop%3D%22name%22%20style%3D%22margin%3A%200px%3B%20position%3A%20relative%3B%20fontstyle%3A%20normal%3B
3/4
6/5/2015
behappyandmakeotherstobehappy:SCDType3
targettable.
UpdateStrategy1:Thisisintendedtoinsertintothetargettable.
Dragalltheportsexcepttheinsertfromthefirstfilterintothis.
InthePropertiestabspecifytheconditionasthe0ordd_insert.
UpdateStrategy2:Thisisintendedtoupdateintothetargettable.
Dragalltheportsexcepttheupdatefromthesecondfilterintothis.
InthePropertiestabspecifytheconditionasthe1ordd_update.
Finallyconnectboththeupdatestrategyintotwoinstancesofthetarget.
Step3:CreateasessionforthismappingandRuntheworkflow.
Step4:Observetheoutputitwouldsameasthesecondtargettable
data:text/htmlcharset=utf8,%3Ch3%20class%3D%22posttitle%20entrytitle%22%20itemprop%3D%22name%22%20style%3D%22margin%3A%200px%3B%20position%3A%20relative%3B%20fontstyle%3A%20normal%3B
4/4