DATASTAGE: oracle_connector控件中PL/SQL的应用

DATASTAGE: oracle_connector控件中PL/SQL的应用
oracle connector 控件 选择 PL/SQL mode 时候使用merge的方法:
Example:
begin
  merge into table_name a
  using (select orchestrate.id id,orchestrate.name name from dual) b
  on (a. id = b.id) 
  when matched then  update set a.name= b.name delete where a.name = 'XXX'
  when not matched then   
  insert  values  (orchestrate.id,orchestrate.name);
end;

Example over:

------------------------------------------------------------------------------------------------------

oracle connector 控件 作为输入控件的时候

Example:

declare 
 tb_name varchar2(20) :='tb_dddl';
 ds_table   varchar2(100) := 'ds' ||  substr(tb_name, 3, length(tb_name) - 2);
 filenumsql varchar2(1000) := 'select count(distinct filename ) from ' ||       ds_table;
 deletesql  varchar2(1000) := 'delete from ' || tb_name;
 insertsql  varchar2(1000) := 'insert into ' || tb_name || ' select * from ' || ds_table;
 filenum    number := 0;
  begin
    execute immediate filenumsql
      into filenum;
    if (filenum = 1) then
      execute immediate deletesql;
      execute immediate insertsql;
      commit;
    else
      null;
    end if;
   end;

Example over:

你可能感兴趣的:(ETL_TOOL)