怎么写游标的引用

lsrzm 2003-08-23 03:10:59
就是让同一个变量根据不同的 条件分别指向不同的 游标
...全文
39 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
lsrzm 2003-09-05
  • 打赏
  • 举报
回复
我要这样的效果:
procedure write_html(arr_name arr_line,a_product varchar2,model number)
is
type cur is ref cursor;
c cur;

begin
if model = 2 then
open c for
select distinct qt.inventory_item_id,
sum(qt.ordered_quantity)ordered_quantity,qt.product_name
from vv_om_qt_v qt
where qt.order_date >= nvl(begin_date,qt.order_date)
group by qt.inventory_item_id,qt.product_name;
else if model = 1 then
open c for
select distinct qt.inventory_item_id,
sum(qt.ordered_quantity)ordered_quantity,qt.product_name
from vv_om_qt_v qt
where qt.order_date >= nvl(begin_date,qt.order_date)

group by qt.inventory_item_id,qt.product_name;
end if;
end if;
loop
fetch c into r_qt;
exit when c%notfound;
v_file := utl_file.fopen(location => v_dir,filename => v_filename,open_mode => 'A');
v_line := '<tr>';
v_line := v_line || '<td nowrap valign="middle" align="center" style = "font-size=12px">'||nvl(r_qt.r_product,' ')||'</td>';
utl_file.put_line(v_file,v_line);
utl_file.fclose(v_file);
v_file := utl_file.fopen(location => v_dir,filename => v_filename,open_mode => 'A');
end loop;
close c;
end write_html;
ningIII 2003-08-23
  • 打赏
  • 举报
回复
Case不就完了嘛
tcmis 2003-08-23
  • 打赏
  • 举报
回复
用if判断一下不就可以了吗,,
if ....
open cursor1;
....
else
open cursor 2;
....
end if ;

17,078

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧