首页 > 数据库技术 > 详细

Writing Text File From A Tabular Block In Oracle Forms

时间:2016-12-25 20:59:37      阅读:192      评论:0      收藏:0      [点我收藏+]
The example given below for writing text file or CSV using Text_IO package from a tabular block in Oracle Forms.
 
Suppose there is a tabular grid data block "Job_History" in your forms and you want to write a CSV on click of a button by reading whole block from top to bottom. The following is the demo screen shot:
 
技术分享
 
You can also download this form from this link Job_History_Csv.fmb.
 
Write the following When-Button-Pressed trigger code for the "Export To CSV" button:
 
Declare
out_file text_io.file_type;
v_line varchar2(1000);
begin
out_file := text_io.fopen(‘C:\job_history.csv‘, ‘w‘);
go_block(‘job_history‘);
-- move control to first record;
first_record;
loop
 v_line := :job_history.employee_id||‘,‘|| :job_history.start_date||‘,‘|| :job_history.end_date ||‘,‘||
           :job_history.job_id||‘,‘|| :job_history.department_id;
 text_io.put_line(out_file, v_line);
 -- move control to next record;
 if :system.last_record = ‘TRUE‘ then
     exit;
 end if;
 next_record;
end loop;
text_io.fclose(out_file);
-- again after completion move control to first record
first_record;
end;
 

Writing Text File From A Tabular Block In Oracle Forms

原文:http://www.cnblogs.com/quanweiru/p/6220334.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!