Why variable/dynamic based option ..?
Lets take a very simple example for this...
Suppose user wants to perform loading from source to target. There are two types of loading
"Initial load" ( first time) target table will be empty & only insert will be performed on target.
"Regular Load" it will be performed after initial & both insert or update may happen on target.
If developers create option "load_option" then at a time he can perform only one type of load either "initial" or "regular"
OR
User have to develop two interfaces & run either of one depending upon type of load. But in this two interfaces are required ( code replication & maintenance overhead)
This can be achieved through a single interface & create variable/dynamic options & its value will be supplied at the time of execution.
Step1: Create A variable "v_load_type" for load type.
In refresh tab :select '#v_load_type' from dual
In refresh tab :select '#v_load_type' from dual
Step2. Create option v_option in IKM.
Step3 .Open IKM
( oracle incremental update) ,
Add/replace existing step in KM
1. /* if regular then do update else don't apply
update */
declare
dummy_var varchar2(10);
begin
<@ if
("regular".equals("<%=odiRef.getOption("v_option")%>"))
{ @>
/* Put the script code when "v_option" value is "regular" or "not null" according to option condition ,which user want to apply*/
<@ } else { @>
/* put else condition script code which user want to apply */
/* put else condition script code which user want to apply */
select null into dummy_var from dual;
<@ } @>
end;
In Interface put Variable #v_load_type in v_option
Step5 Make a package
a. Refresh variable v_load_type
b. Next step add interface.
c. Create a package scenario with variable parameter v_load_type
Perform "Initial load" :
Pass parameter 'initial' to the scenario ,only Insert script will be generated/update will not take place
So Finally an option can be made dynamic through appending code
declare
dummy_var varchar2(10);
begin
<@ if ("regular".equals("<%=odiRef.getOption("v_option")%>")) { @>
--------- Put the code to be genetaed or executed...
<@ } else { @>
select null into dummy_var from dual;
<@ } @>
end;
SUPER NEERAJ
ReplyDeletebut i have a doubt where we write the code
ReplyDelete* if regular then do update else don't apply update */
declare
dummy_var varchar2(10);
begin
<@ if ("regular".equals("<%=odiRef.getOption("v_option")%>")) { @>
/* Put the script code when "v_option" value is "regular" or "not null" according to option condition ,which user want to apply*/
<@ } else { @>
/* put else condition script code which user want to apply */
select null into dummy_var from dual;
<@ } @>
end;