How Could I use this method in a package ?Is it in a procedure I should be using this ?
Yes it can be used in procedure or refresh variables,
You may create some test package and try it.
I am not getting how to use these in procedure. I can see that getpreviousstep in knowledge module . So how to use it in a procedure.
In a variable you can write as
Select odiref.getprevsteplog(message) from dual.
Please take care of formatting.
SELECT odiRef.getException getPrevStepLog("MESSAGE") : No previous Step FROM DUAL . This is the query that is getting executed in the log . I did exactly the way you did . But it throws me an error . Caused By: java.sql.SQLSyntaxErrorException: ORA-00923: FROM keyword not found where expected
I have kept it just after the mapping .
This is the actual query.
SELECT '<%=odiRef.getPrevStepLog("MESSAGE")%>' FROM DUAL (remove quotes if didn't work)
There is nothing like odiRef.getException getPrevStepLog("MESSAGE")
SELECT '<%=odiRef.getPrevStepLog("MESSAGE")%>' FROM DUAL
When I use the same thing, I get this query executed when I check the log
SELECT odiRef.getException getPrevStepLog("MESSAGE") : No previous Step FROM DUAL
and throws the error .
I am using the same query as you gave .
This is because the procedure in which the query is executed is the first step in the package.
odiRef.getPrevStepLog refers to previous step of the package.
I hope you are querying using ODI variable. Drag and drop the odi variable onto package and map other odi objects to this variable using KO.
If any failure occurs in the package then this variable gets executed and error message will be captured.
As Adrian_Popescu-Oracle explained odiref.getPrevStepLog will capture previous step error message.
I've done this multiple times for clients and the best method is to leverage the Load Plan to orchestrate various execution paths based. From a maintenance cost perspective, this is also a good path to take.
Here's what you will need to approach this solution. I am not going to dictate exactly how you solve this.
1) A job control table. A table which gets written to as the ODI job proceeds. This is pretty much a given.
2) Global variables to test the conditions in question using job control table in #1
3) Introduce ODI CASE steps at the junctures in processing you need. They can be nested if needed
4) Create a series of exception steps in the load plan for your various scenarios
4) Based on the given step which is failing, you can select the specific error step to raise
Again, I have done this for a client who had to wrangle data from 14 different source systems - all which had various maintenance schedules to navigate around.
Hope this helps.