设为首页 加入收藏

TOP

一个ref cursor的使用例子(三)
2014-11-24 02:08:18 来源: 作者: 【 】 浏览:3
Tags:一个 ref cursor 使用 例子
ute immediate mySql;
Dbms_Output.put_line(mysql);
mysql := 'select wmsys.wm_concat(d.nUserId) from (select wpa.nFlowId, wpa.nUserId,'||
'row_number() over (partition by wpa.nDocId order by wpa.nFlowId) rowNumId,'||
'row_number() over (partition by wpa.nFlowId order by wpa.nOrder desc) rowNumberId '||
'from wf_proc_action wpa, wf_doc_gw gw '||
'where wpa.ndocid = gw.nDocId '||
'and wpa.nProcId = gw.nProcId '||
'and wpa.dfnshdate is null '||
'and gw.nDocId = '||n_nDocId||') d where d.rowNumberId=1 and d.rowNumId=1';
Dbms_Output.put_line(mysql);
open c_todoUserIds for mysql;
loop
fetch c_todoUserIds into v_todoUserIds;
exit when c_todoUserIds%notfound;
Dbms_Output.put_line('v_todoUserIds:'||v_todoUserIds);
end loop;
close c_todoUserIds;
if(v_todoUserIds is null) then
mysql:='update wf_doc_gw set cProcUserList='||n_userId||', nProcStatus=1 where nDocId='||n_nDocId;
else
mysql:='update wf_doc_gw set cProcUserList='||v_todoUserIds||',nProcStatus=0 where nDocId='||n_nDocId;
end if;
execute immediate mySql;
Dbms_Output.put_line(mysql);
end if;
Exit when c_fixing_docIds%notfound;
end loop;
commit;
Exception
when others then
close c_fixing_docIds;
rollback;
Dbms_Output.put_line(Sqlerrm);
if c_fixing_docIds%isopen then
close c_fixing_docIds;
end if;
end prod_fixing_datacb;
首页 上一页 1 2 3 下一页 尾页 3/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇dbms_xplan之display_cursor函数.. 下一篇oracle游标cursor简单使用

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: