oralce存储过程

create or replace procedure p_convertUMaccount
as
begin
  merge into t_agent_agentinfo a
  using (select agentid,ccid,vdnid,umaccount from T_AGENT_IMPORTUM) b
  on (a.agentid = b.agentid and a.ccid = b.ccid)
  when matched then update set a.umaccount = nvl(b.umaccount,a.umaccount)
  when not matched then insert(a.agentid,a.ccid,a.companyid,a.umaccount) values(b.agentid,b.ccid,b.vdnid,b.umaccount);

  delete from T_AGENT_IMPORTUM;

  commit;
exception
when others then
  rollback;
  dbms_output.put_line(sqlerrm);
end;


 

猜你喜欢

转载自blog.csdn.net/weixin_42386617/article/details/89190632