用if判断一下不就可以了吗,,
if ....
open cursor1;
....
else
open cursor 2;
....
end if ;
if ....
open cursor1;
....
else
open cursor 2;
....
end if ;
解决方案 »
- (100分)禁用索引报错:ORA-02243: ALTER INDEX 或 ALTER MATERIALIZED VIEW 选项无效
- 菜鸟问个oracle 10G的enterprise manager添加数据库怎么添加呢?
- SQL 缓冲区中无可运行的程序
- 请教基础问题
- ADO连接ORACLE数据库的问题?在线等待!!
- 原始排序问题!
- 如何用用一个批处理文件实现执行多个sql文件?谢了先
- oracle关于日期的比较问题,急!
- 怎么将一张表(数据量比较大)的数据分段更新到另一张表
- oracle登陆问题
- java.sql.SQLException: No more data to read from socket
- 请问,触发器中能不能使用COMMIT
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;