首页  ·  知识 ·  数据库
oracleform导出excle实例
网友      编辑:德仔   图片来源:网络
"cnt" id="blog_text"> 利用developer 2000 form 导出excle文件,在网上狂找了n个范例,但是都太复杂了,以下个人觉得比较简单,请各位

利用developer 2000 form 导出excle文件,在网上狂找了n个范例,但是都太复杂了,以下个人觉得比较简单,请各位高人指点:

declare
out_file   text_io.file_type;
    str     varchar2(1000);
sys_date   varchar2(20);

cursor s1 is
select a.prod_no||' '||c.product_name||' '||c.style||' '||d.inout_type_id||' '||to_char(b.qty_old_p)||'/'||to_char(b.qty_old_h)||' '||to_char(b.qty_p)||'/'||to_char(b.qty_h)||' '||to_char(TRUNC(sum(a.qty_std)/ MAX(c.CONVERSION_RATE)))||'/'||to_char(MOD(sum(a.qty_std),MAX(c.CONVERSION_RATE)))
from a,b,d
where a.prod_no=c.product_id
and a.prod_no = b.prod_no
and a.sales_no = d.IO_TYPE_ID
--and a.branch_no = b.branch_no
and a.yyyymm=b.yyyymm
and a.yyyymm=:B1.stk_year||:B1.stk_month
and substr(a.prod_no,1,1) not in('3','5')
and a.data_source_mark||a.sales_no <>'1062'
group by a.prod_no,c.product_name,c.style,d.inout_type_id,b.yyyymm,b.qty_old_p,b.qty_old_h,b.qty_p,b.qty_h
order by a.prod_no;
    r1 s1%rowtype;
begin
   synchronize;
   SYS_DATE:=to_char(sysdate,'YYYYMMDDHH24MISS');
   out_file:=text_io.fopen('D:\test.xls','w');
    open s1 ;
    loop
  
    fetch s1 into str;
    exit when not s1%found;
    text_io.put_line(out_file,str);
   end loop;
   close s1;
   text_io.fclose(out_file);
   MESSAGE('资料导出完成!请查看D盘test.xls文件');
end;

本文作者:网友 来源:网络
CIO之家 www.ciozj.com 微信公众号:imciow
    >>频道首页  >>网站首页   纠错  >>投诉
版权声明:CIO之家尊重行业规范,每篇文章都注明有明确的作者和来源;CIO之家的原创文章,请转载时务必注明文章作者和来源;
延伸阅读
也许感兴趣的
我们推荐的
主题最新
看看其它的