SQL SERVER与oracle中的递归处理

来源:互联网 发布:linux snmp测试 编辑:程序博客网 时间:2024/06/05 14:19
<span style="font-size:18px;color:#ff0000;"><strong>sql server</strong></span>-----------------------------------------------
    update um_ctype set ctype = #ctype#,cname=#cname#,disable_flag = #disable_flag#, disp_order=#disp_order# where ctid = #ctid#;
    with qur_child 
    as
    (
        select uc.smid from UM_CLINK uc
        where EXISTS (select ctid from um_ctype t where uc.pmid = #ctid#)
        union all
        select a.smid from UM_CLINK a
        inner join 
        qur_child b
        on ( a.pmid=b.smid)

    )      

   update UM_CTYPE set disable_flag = #disable_flag# where EXISTS(select smid from qur_child where smid = ctid); 

----------------------------------------<strong><span style="font-size:18px;color:#ff0000;">oracle</span></strong>------------------------------------------
   begin

update um_ctype set ctype = #ctype#,cname=#cname#,disable_flag = #disable_flag#,disp_order=#disp_order# where ctid = #ctid#;           

update UM_CTYPE set disable_flag = #disable_flag# where ctid in(select distinct smid from UM_CLINK start with pmid = #ctid# connect by prior smid=pmid); 

  end;

0 0
原创粉丝点击