首页 > 代码库 > Writing Text File From A Tabular Block In Oracle Forms
Writing Text File From A Tabular Block In Oracle Forms
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
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。