MULTIPLE FILES - SINGLE TARGET TABLE-SINGLE INTERFACESteps to use a single interface to load all the flat files of same structure into the single targettable.Lets consider that you have three Flat files namely FILE1.txt,FILE2.txt and FILE3.txt to beloaded into TRG_TBL table of ORACLE database.In order to achieve this scenario, first of all you need to create a simple ODI routine to load datafrom FILE.txt file to TRG_TBL, by performing following steps.Go to Start > Programs > Oracle > Oracle Data Integrator > ODI Studio .Select DSBWR13 from the Login Name drop-down. Enter SUPERVISOR in the User field andpassword in the Password field. Click OK to login.Go to Topology Manager >> Physical Architecture >> File >> FILE_GENERIC. Right click onFILE_GENERIC and select New Physical schema. See below screen shot for more info.
Enter complete path where your data files are located under Schema and Work Schema fieldsand press Save button.
In topology manager, go to Logical Architecture >> File. Right click on File technology andselect New Logical Schema.
Choose Physical schema under Global context.Create new project and import LKM File to SQL and IKM SQL Control Append knowledgemodules.Now, you need to reverse engineer source file.Insert new model.
Right click on your newly create data model and select New Datastore.
Enter details required for creating Datastore and press Save button. See below screens for moredetails.
Now create RDBMS schema/user by executing below SQL query.SQL> create user ODI_MULTI_TEST identified by password default tablespace userstemporary tablespace temp;Grant privileges to ODI_MULTI_TEST user using below command.SQL> grant connect, resource to ODI_MULTI_TEST;Connect to SQL using this newly create user and execute following commands.
SQL> conn ODI_MULTI_TESTEnter password:Connected.SQL> CREATE TABLE SRC_FILE_DETAILS 2 ( FILE_NAME VARCHAR2(10 BYTE) 3 );Table created.SQL> INSERT INTO src_file_details values (FILE1);1 row created.SQL> INSERT INTO src_file_details values (FILE2);1 row created.SQL> INSERT INTO src_file_details values (FILE3);1 row created.Create target table.SQL> CREATE TABLE TRG_TBL ( 2 "EMPNO" NUMBER(10,0) NOT NULL, 3 "ENAME" VARCHAR2(200), 4 "JOB" VARCHAR2(200), 5 "MGR" VARCHAR2(200), 6 "HIREDATE" VARCHAR2(200), 7 "SAL" VARCHAR2(200), 8 "COMM" VARCHAR2(200), 9 "DEPTNO" VARCHAR2(200),10 CONSTRAINT "TRG_TBL_PK" PRIMARY KEY ("EMPNO")11 );Table created.Now you need to create variables by performing below steps:In Designer panel, go to Projects >> [PROJECTNAME] >> Variables.Right click Variables and select New Variable.See below screens for variable creation steps.
In order to create target data server, perform the below steps:In topology manager, go to Physical Architecture >> Oracle technology. Right click on Oracletechnology and select Insert Data Server.Enter required parameters and press Save button.
Drag and drop count variableDrag and drop Files_Count variable.
Drag and drop count variable.Now, customized your package. It should look like below screen.
Before executing package, verify that your target table is empty, by performing following steps.In Designer, go to Model >> TRG_TBL. Right click on TRG_TBL and select View Data.It will show you TRG_TBL table content.Your target table is empty. Now execute the package by performing below steps.In Designer, go to Projects >> [YOURPROJECT] >> Packages >> [YOURPACKAGE].Right click on [YOURPACKAGE] and select execute.
You can see the result of your package execution either in Operator or by viewing data of yourtarget table directly from Designer.
Thats it, you have now successfully loaded data from multiple files to a single target table usingsingle interface.