Call odi Mappig through PL/SQl Procedure

2019-08-24 05:08发布

enter image description hereenter image description hereI have an anonymous block mentione below , i want to replace the execute immediate statement with the odi scenarion .

Any way of doing it with odi procedure. If i can use any odi api or odi utilities command to replace it.

i.e:

OdiStartScen "-SCEN_NAME=LD_T_RD_ACCOUNT_POC" "-SCEN_VERSION=001" "-CONTEXT=GLOBAL" "-LOG_LEVEL=6" "-AGENT_CODE=OracleDIAgent1" "-SYNC_MODE=1";

DECLARE

   VAR            VARCHAR2(2000);
   VAR2           DATE;

BEGIN
   BEGIN
         Select XYZ INTO VAR
         From DUMMY
         Where ID= 2; end;

       BEGIN

          l_exec_sql:= 'INSERT INTO DUMMY VALUES('1')';

      IF VAR LIKE 'XY%' THEN
       execute immediate(l_exec_sql); --Replace it with odi scenario
      ELSE
       IF FUNCTION_F(VAR) THEN
          execute immediate(l_exec_sql); --Replace it with odi scenario
       END IF;
      END IF;
 END;

1条回答
家丑人穷心不美
2楼-- · 2019-08-24 05:28

Regarding your anonymous block, you should rewrite it like this:

  • Create a new ODI package;
  • Create new variable named VAR (or how you like it), inside the var, put what you need, pairing with the proper logical schema;
  • open the newly create ODI Package, drag-and-drop the variable and choose the Refresh Variable Type (see below picture);
  • after drag-and-drop variable, choose it again and drag-and-drop, this time choosing the type Evaluate variable, and the write your first condition (see picture below);
  • then drag and drop what ODI scenario do you need;

You can "play" in many more ways with the odi package variables. For example, you can create a variable that will return YES if the first condition is meet and NO if second one is meet. Your variable will execute an sql statement and will return a value (only one row, one column) and then you will evaluate it and choose what scenario to execute.

Hope that it was useful

EVALUATE VARIABLE refresh variable

EDIT 1:

You can call an ODI Scenario from ODI Procedure, but the techonology should be ODI Tools, for the task that will call the scenario.

For your example you can do like this: * inside your plsql block, where you have "--Replace it with odi scenario", place this substitution variables : ""; on the second variable evaluate, place "" etc; * in the same procedure, make another task and write something like this:

<$
if (var.equals("call secenario 1") {
$>
OdiStartScen "-SCEN_NAME=NAMEOFSCENARIO" "-SCEN_VERSION=001"
<$
}
$>

This new task should have Techonology: ODI Tools.

You can't call the scenario in the same task that will run the plsql procedure, because the PLSQL procedure will need Technology Oracle and the calling of scenario will need ODI Tools.

EDIT 2:

To see the value in operator, go to your ODI Procedure, and please check the next option for each of your task. Save an regenerate the scenario (if you have a scenario):

CHECK LOG FINAL COMMAND

EDIT 3:

Where to see the code in Operator: Double click the session > choose the task you want to see> expand it> double click > Code

enter image description here

查看更多
登录 后发表回答