笨小孩做开发

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
create or replace procedure PROC_WF_SL_LCJD_UI

is

errstr            VARCHAR2(6000):='';

errstr_sql        VARCHAR2(6000):='';

begin

update /*+ BYPASS_UJVC */

(

  select F_JDMC a , F_JDLX b ,F_LCNM  c ,F_LCBH d  ,F_LCMC e 

  ,a1,b1,c1,d1,e1 from WF_SL_LCJD

  left join

  (

select n.data_id,n.node_desc a1,node_type b1,p.data_id c1,p.proc_no d1
,p.proc_name e1 from wf_node n,wf_proc p

where n.proc = p.data_id

  ) t on WF_SL_LCJD.DATA_ID = t.data_id

  ) set  a=a1,b=b1,c=c1,d=d1,e=e1;

insert into WF_SL_LCJD (data_id, F_JDMC  , F_JDLX  ,F_LCNM   ,F_LCBH
,F_LCMC ) 

select n.data_id,n.node_desc a1,node_type b1,p.data_id c1,p.proc_no d1
,p.proc_name e1 from wf_node n

left join wf_proc p on n.proc=p.data_id where p.data_id is not null

and not exists(select 1 from WF_SL_LCJD c where
n.data_id=c.data_id);



commit;

EXCEPTION

WHEN OTHERS

   THEN

   rollback;

    errstr := SQLERRM(SQLCODE);

    errstr:=substr(errstr,11);

    if(errstr_sql is not null)then

      errstr:= errstr||'Proc_WF_SL_LC_UI在执行'||errstr_sql||'时出错:';

    end if;

   RAISE_APPLICATION_ERROR(-20018,errstr);



END PROC_WF_SL_LCJD_UI;
posted on 2013-01-06 14:14  笨小孩做开发  阅读(184)  评论(0编辑  收藏  举报