Procedures (or KM) Steps – Source and Target tab’s
Hi All,
There is some time that I don’t write a post, it’s because of the amount of work… too much clients, too much process… but all is perfect! I mean, work needs to exists because then it’s necessary people to do it!
OK, today we are going to talk about those two tab’s at procedure step:
- Source Tab
- Target Tab
Obs.: When I say “Procedure Step” I mean “Procedure or KM Step” once this objects are almost the same but this is subject for another post.
Because of the interfaces, that has source and target tables, a obvious association is done and that is right. The difference is:
- Interface:
- Has Source and Target Table in generic way, KM’s are necessary to define how to push data from source to target normally in several steps
- Source and Target Tab’s at Procedure Step:
- It’s a single action (commands) between a defined source technology and a defined target technology
Before go to examples, a last information:
The most interesting and powerful characteristic of these tab’s is the ability of:
- When a SQL query (select..) is executed in Source tab, the code wrote at Target tab will be executed once to each returned record from the SQL query
After theory and definitions, examples!
- LKM SQL to SQL
- This is the most classical example of functionality and interaction between the tab’s once, after create the C$, it transfers every single record from the query in the source to a “insert” command into target tab (Step 31 – Load Data)
-
Send records fom a Postgre SQL table to an Oracle procedure
-
Source Query:
-
Select Name, Age from Client
-
-
Target Oracle Procedure:
-
pClient(Name as varchar, Age as date)
-
Before tell you how to implement, let me discuss about a very important issue: How are the returned values “delivered” to Target Tab???
Let’s remember few points:
-
ODI is a code generator
-
The generated code can be at any programming language or RDBMS command
-
ODI variables exists only in ODI, they aren’t able to exist inside, for instance, of a PL/SQL code in execution at Oracle database.
A new point that, maybe, you aren’t aware about is:
-
The responsible to execute the interaction between the Source and Table tab is the Agent
Note that we will send a query from Postrgre SQL to Oracle it means, two distinct RDBMS.
For Oracle people, this explain how ODI can integrate several Oracle databases with no DBLink.
As I mentioned above, ODI will generate the code and send it to the Oracle database, but how to indicate, in the generated code, where use a column from source?
It’s easy. The query I proposed is:
Select Name, Age from Client
The code for target tab will be:
BeginpClient(:Name, :Age);End;
By using the column name prefixed with “:”, ODI understand that is to generate the Oracle code with the equivalent column from Postre query.
If a function was used in the souce like:
select EXTRACT(DAY FROM TIMESTAMP age) from Client
Just add an Alias and use it at target tab:
select EXTRACT(DAY FROM TIMESTAMP age) as Birthday from Client
Well, that is all friends!
The code at Target tab will be executed some many times as the amount of records returned from the Postgre query.
Just remember to setup the respective technology and Logical schema at each tab.
Best Regards,
Cezar Santos
Posted: November 20th, 2009 | Author: Cezar Santos | Filed under: Architecture, How to, Logic, ODI, Tips and Tricks | Tags: ODI, ODI Adminstration, ODI Agent, ODI connection, ODI Context, ODI Data Server, ODI Experts, ODI Logical Schema, ODI Physical Schema, ODI Procedure, ODI repository, ODI Scenario, ODI Step, ODI variable, Oracle Data Integrator, PL/SQ Functions, PL/SQL Parameters, PL/SQL Procedures, Procedure Step, repositories, repository, Sunopsis, sysdate source | Comments: 6 Comments »




Hey guys!
In my case, the function snpRef.getColList returns quotes in the columns names.
How can I remove them?
Thanks!
Hi Josue,
Thanks for visiting us. Can you please try this way .
< %=odiRef.getColList("", "[CX_COL_NAME]", ",\n\t", "","")%>
In case you are still getting error , can you please let me know what is the code you are using , so we can guide you accordingly.
Thanks
Kshitiz Devendra
Hi Kshitiz!
When I used the function odiRef.getColList, the columns names in the query select generated were created with quotes, for example:
select
PRODUCTS.”cd_product”
PRODUCTS.”desc_product”
…
When that query runs, an error happens. In my case, Oracle doesn’t know columns with quotes. I think that’s a database configuration, I don’t know…
So, I’d like to know if is possible to edit the LKM SQL to SQL to use some function (or something like this) to remove the quotes. Or if I can to solve the problem through another way…
Thanks!
The reason is that ODI automatically applies the column name with double quotes if the column name is in lowercase .
The solution is to use the capital name for the column name and try , ODI won’t add the double quote then.
So cd_product should CD_PRODUCT ,desc_product should be DESC_PRODUCT
Hi All,
We have migrated from sunopsis to ODI recently .The interface is quite simple generating files with double quotes to delimit the fields. the fields are separated by ;
the result is different with ODI than with sunopsis. we only migrate and don’t change the interfaces.
with sunopsis a field contains a ” character : sunopsis double it automatically
now ODI does nothing on the quotes and we get unbalanced quotes.
I have used the following Datastore- Files Delimiter options.
Datastore -> Files Tab
a) File Format – Delimited
b) Heading (number of lines) – 0
c) Record Separator – MSDOS
d) Field Separator – Other (;) Hexadecimal (3B)
e) Text Delimiter – ”
f) Decimal Separator – ,
Request for your valuable pointers on this.
Thanks & Regards,
Kalyan
Hi Kalyan,
Good to see you around…
Please, send me an email in cezar.santos@odiexperts.com with a sample of the ODI 11g generated file…