Writing Text File From A Tabular Block In Oracle Forms

Posted ORACLE EBS

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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的主要内容,如果未能解决你的问题,请参考以下文章

数据分析文摘:Reading and Writing JSON to a File in Python

Display certain line(s) from a text file in Linux.

踩坑记录SQLException: Error writing file ‘C:WindowsTEMPMY8C3D.tmp‘ (Errcode: 28)

text 糟糕的滚动writing.pde

Apache POI – Reading and Writing Excel file in Java

R语言使用read_table函数读取文本文件或者文本数据生成dataframe数据集从分隔文本文件中导入数据(Importing data from a delimited text file)