Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
InformaticaSQLTransformation,SQLsBeyondPre&PostSessionCommands|InformaticaTraining&Tutorials
InformaticaSQLTransformation,SQLsBeyondPre&PostSessionCommands
JohnsonCyriac
Sep24,2013
Transformations
Tweet
Like
107
Share
32
SQL statements can be used as part of pre or post SQL commands in a PowerCenter
workflow.ThesearestaticSQLsandcanrunonlyoncebeforeorafterthemappingpipelineis
run. With the help of SQL transformation, we can use SQL statements much more effectively to build your ETL
logic.Inthistutorialletslearnmoreaboutthetransformationanditsusagewitharealtimeusecase.
WhatisSQLTransformation
The SQL transformation can be used to processes SQL queries midstream in a mapping. You can execute any
valid SQL statement using this transformation. This can be external SQL scripts or SQL queries that are created
withinthetransformation.SQLtransformationprocessesthequeryandreturnsrowsanddatabaseerrorsifany.
ConfiguringSQLTransformation
PopularPosts
SQLtransformationcanrunintwodifferentmodes.
Scriptmode : Runs SQL scripts from text files that are externally located. You pass a script name to the
transformationwitheachinputrow.Itoutputsscriptexecutionstatusandanyscripterror.
Querymode:Executesaquerythatyoudefineinaqueryeditor.Youcanpassstringsorparameterstothe
querytodefinedynamicqueries.YoucanoutputmultiplerowswhenthequeryhasaSELECTstatement.
InformaticaPowerCenter9
InstallationandConfiguration
CompleteGuide
ImplementingInformatica
PowerCenterSessionPartitioning
Algorithms
ScriptMode
An SQL transformation running in script mode runs SQL scripts from text files. It creates an SQL procedure and
sends it to the database to process. The database validates the SQL and executes the query. You cannot use
scriptinglanguagessuchasOraclePL/SQLorMicrosoft/SybaseTSQLinthescript.
InformaticaPerformanceTuning
Guide,TuningandBottleneck
OverviewPart1
SCDType2Implementationusing
InformaticaPowerCenter
In the script mode, you pass script file name with the complete path from the source to the SQL transformation
ScriptName port. ScriptResult port gives the status of the script execution status. It will be either PASSED or
FAILED.ScriptErrorreturnserrorsthatoccurwhenascriptfailsforarow.
InformaticaPerformanceTuning
Guide,IdentifyPerformance
BottlenecksPart2
SurrogateKeyinDataWarehouse,
What,WhenandWhy
InformaticaIncremental
AggregationImplementationand
BusinessUseCases
Above shown is an SQL transformation in Script Mode, which will have a ScriptName input and ScripResult,
ScriptErrorasoutput.
ChangeDataCapture(CDC)Made
EasyUsingMappingVariables
QueryMode
When SQL transformation runs in query mode, it executes an SQL query defined in the transformation. You can
passstringsorparameterstothequeryfromthetransformationinputportstochangetheSQLquerystatementor
thequerydata.TheSQLquerycanbestaticordynamic.
StaticSQLquery:Thequerystatementdoesnotchange,butyoucanusequeryparameterstochangethe
data,whichispassedinthroughtheinputportsofthetransformation.
DynamicSQLquery : You can change the query statements and the data, which is passed in through the
LatestPosts
AnETLParameterFrameworkto
DealwithallsortsofParametrization
Needs
DynamicTransformationPort
LinkingRulesinInfromaticaCloud
Designer
inputportsofthetransformation.
With static query, the Integration Service prepares the SQL statement once and executes it for each row. With a
http://www.disoln.org/2013/09/InformaticaSQLTransformationBeyondPrePostSessionSQLCommands.html
InformaticaCloudMappingTutorial
forBeginners,BuildingtheFirst
1/6
4/2/2015
InformaticaSQLTransformation,SQLsBeyondPre&PostSessionCommands|InformaticaTraining&Tutorials
Mapping
dynamicquery,theIntegrationServicepreparestheSQLforeachinputrow.
InformaticaIncrementalAggregation
ImplementationandBusinessUse
Cases
InformaticaCloudDesignerfor
AdvancedDataIntegrationOnthe
Cloud
AboveshownSQLtransformation,whichrunsinquerymodehastwoinputparametersandreturnsoneoutput.
SQLTransformationUseCase
BeingViewed
UserDefinedErrorHandlingin
InformaticaPowerCenter
Lets consider the ETL for loading Dimension tables into a data warehouse. The surrogate key for each of the
dimension tables are populated using an Oracle Sequence. The ETL architect needs to create an Informatica
ChangeDataCapture(CDC)Made
EasyUsingMappingVariables
reusablecomponent,whichcanbereusedindifferentdimensiontableloadstopopulatethesurrogatekey.
SplitYourInformaticaPowerCenter
TargetFileDynamicallyBasedon
theContent
Solution:HereletscreateareusableSQLtransformationinQuerymode,whichcantakethenameoftheoracle
sequencegenerator,andpassthesequencenumberastheoutput.
UseCHECKSUMNumbertoMake
theLookUpTransformationSimple
Step1: Once you have the transformation developer open you can start creating the SQL transformation like
anyothertransformations.Itopensupawindowlikeshowninbelowimage.
UnderstandInformatica
PowerCenterWorkflowManager
InformaticaJavaTransformationto
LeveragethePowerofJava
Programming
InformaticaPowerCenterInstallation
KnownIssuesandSolution
BlogArchive
2014(11)
2013(49)
December(2)
November(4)
October(4)
September(4)
This screen will let you choose the mode, database type, database connection type and you can make the
transformation active or passive. If the database connection type is dynamic, you can dynamically pass in the
connectiondetailsintothetransformation.IftheSQLqueryreturnsmorethanonerecord,youneedtomakethe
transformationactive.
Step 2 : Now create the input and output ports as shown in the below image. We are passing in the database
schemanameandthesequencename.Itreturnsequencenumberasanoutputport.
InformaticaHTTPTransformation,
TheInterfaceBet...
InformaticaSQLTransformation,
SQLsBeyondPre&...
InformaticaJavaTransformationto
LeveragethePo...
InformaticaPerformanceTuning
Guide,IdentifyPer...
August(4)
July(4)
June(3)
May(3)
April(5)
March(5)
February(5)
January(6)
2012(38)
http://www.disoln.org/2013/09/InformaticaSQLTransformationBeyondPrePostSessionSQLCommands.html
2/6
4/2/2015
InformaticaSQLTransformation,SQLsBeyondPre&PostSessionCommands|InformaticaTraining&Tutorials
Begin
Design
Performance
Tips
Admin
DISTV
TrainingNew
Search...
EnterEmailAddresshere
SignUp
Step 3 : Using the SQL query editor, we can build the query to get the sequence generator. Using the 'String
Substitution'portswecanmaketheSQLdynamic.Herewearemakingthequerydynamicbypassingtheschema
name,sequencenamedynamicallyasaninputport.
ThatisallweneedforthereusableSQLtransformation.BelowshownisthecompletedSQLtransformation,which
cantaketwoinputvalues(schemaname,sequencename)andreturnsoneoutputvalue(sequencenumber).
Step4:Wecanusethistransformationjustlikeanyotherreusabletransformations,Needtopassintheschema
name,sequencenameasinputportsandreturnssequencenumber,whichcanbeusedtopopulatethesurrogate
http://www.disoln.org/2013/09/InformaticaSQLTransformationBeyondPrePostSessionSQLCommands.html
3/6
4/2/2015
InformaticaSQLTransformation,SQLsBeyondPre&PostSessionCommands|InformaticaTraining&Tutorials
keyofthedimensiontableasshownbelow.
Aspertheaboveexample,integrationservicewillconverttheSQLasfollowsduringthesessionruntime.SELECT
DW.S_CUST_DIM.NEXTVALFROMDUAL
Hopeyouenjoyedthistutorial,Pleaseletusknowifyouhaveanydifficultiesintryingoutthistutorialorshareusif
youuseanydifferentusecasesyouwanttoimplementusingSQLtransformation.
IfYouEnjoyedThisPost,PleaseTakeaMomentToShareIt.
Share
Tweet
Like
107
Share
32
EnterEmailAddresshere
SignUp
PleaseTakeaMomenttoLeaveYourCommentsandThoughtsBelow.
http://www.disoln.org/2013/09/InformaticaSQLTransformationBeyondPrePostSessionSQLCommands.html
4/6
4/2/2015
InformaticaSQLTransformation,SQLsBeyondPre&PostSessionCommands|InformaticaTraining&Tutorials
15comments
Addacomment
DuraisamyKrishnanThanthiHansRoevercollege
Hi,Caniabletoexecutethestoredprocedureinsqltransformation?
ReplyLike6Februaryat09:38
InformaticaTraining&Tutorials
AslongasyourproccanbecalledaspartofavalidSQLstatement,youcanuseitisSQL
transformation,HoweveryoucannotusePL/SQLorTSQLblocksinSQLTransformation,
alternativelyyoucanusestoredproceduretransformation.~JC
ReplyLike8Februaryat19:51
LeonardoDorighetto TopcommenterFeucFundaoEducacionalUnificadaCampograndense
IhaveaproblemwhenItrytousethisSQLTransformation.Idon'tknowwhatishappening,butmysql
transformationisnotworking.Couldyouhelpme?Whatmaybehappening?I'mtryingtodoastaticSQL
TransformationandI'musingInformatica9.1.Ididexactlyinthesamewaythatyoudidinyour
explanation.
ReplyLike7Januaryat10:41
InformaticaTraining&Tutorials
Youshouldseetheerrordetailinthesessionlogfile.Sessionlogfilecanansweryourquestion.
~JC
ReplyLike22Januaryat19:48
EaswaramoorthyNavaneethanCollegeofEngineering,Trivandrum
NiceexplanationonSQtransfinsteadofSequence
ReplyLike26April2014at09:01
VishnuVNairBangalore,India
plsexplainthedifferencebetweendoingSQLqueryinSQandqueryinginSQLtransformation...likeasetof
differnces?
ReplyLike2October2013at06:51
VishnuVNairBangalore,India
BonyBabyAugustine:D
ReplyLike2October2013at06:54
InformaticaTraining&Tutorials
Fewquickdifferences,
SQ
1.CanhaveonlystaticSQL.
2.Runsonlyonceforasession.
3.StaticDBconnection.
4OnlySELECTstatementspossible.
SQLTrans
1.CanhavestaticordynamicSQL,evenscripts.
2.Runsforeveryrowprocessed.
3.CanhavedynamicDBconnection.
4.AnyvalidSQLcanexecute.
Remembertheschooldays)
~JC
ReplyLike
3 2October2013at13:17
InformaticaTraining&Tutorials
BonyBabyAugustine
Pleasefeelfreetoaddyouthoughts~JC
ReplyLike2October2013at13:20
View1more
ShahHamza
IneedtoaddacreateindexanddropindexintheTargettable(PREandPOSTSQL)ofastagingmapping
whichimportsaflatfilefromthesource.WhenidothisintheTargetpreandpostsqligetanerror
"executionstoppedunexpectedly"forbothsessionandworkflow.Pleasehelpmewhatcanbedonehere?
ReplyLike30September2013at09:56
InformaticaTraining&Tutorials
Yougaveusverylittleinformationtotroubleshoottheissue.Pleaseshareusthesessionlogfile
@info@disoln.org.wewilltakealook~JC
ReplyLike30September2013at10:21
ParagVarma
Thatwasniceexplanation.Thankyou.Betweencanyouplztelmeifinabovecaseansequencegenerator
transformationcouldbeused(asabetteroption)insteadofsqltransformation?
ReplyLike27September2013at02:47
InformaticaTraining&Tutorials
Iwouldprefertousethisapproachtopopulatesurrogatekey,becausewecanuseORAsequence
numberoutsideoftheinformaticaETLprocessandinsertnewdataintodimensiontable,ifincase
requiredtofixanyproductionissues.Butwithinfasequencegeneratorwecannotdoanyinserts
outsideofinformaticaETLprocess.ThedownsideofORAsequenceistheperformance,infa
sequencegeneratorperformsbetter~JC
ReplyLike
1 27September2013at08:09
Facebooksocialplugin
http://www.disoln.org/2013/09/InformaticaSQLTransformationBeyondPrePostSessionSQLCommands.html
5/6
4/2/2015
InformaticaSQLTransformation,SQLsBeyondPre&PostSessionCommands|InformaticaTraining&Tutorials
OlderPost
NewerPost
AboutUS
ContactUS
Advertise
GuestPost
TermsandConditions
PrivacyPolicy
Disclaimer
20122013DataIntelligenceSolution,AllRightsReserved
ThecontentsinthissiteiscopyrightedtoDataintelligenceSolutionandmaynotbereproducedonotherwebsites.
http://www.disoln.org/2013/09/InformaticaSQLTransformationBeyondPrePostSessionSQLCommands.html
6/6