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;

时间: 2024-12-20 08:48:56

Writing Text File From A Tabular Block In Oracle Forms的相关文章

Moving From Top To Bottom in Detailed Block in Oracle Forms

Suppose you want to scan a tabular grid block (loop through all records in detail block) from top to bottom in Oracle forms. You can do this task by using :system.last_record system variable to determine whether it is last record in a block and then

Sort Detail Data Block Example - Oracle Forms

Example is given below to sort detail data block data (toggle asc or desc) with push buttons used as header of grid, by setting ORDER_BY property of data block using SET_BLOCK_PROPERTY command. The following is the screen shot of this example and thi

Determining Current Block and Current Item in Oracle Forms

SYSTEM.CURSOR_BLOCK Determining current block in Oracle Forms Using SYSTEM.CURSOR_BLOCK system variable. The value that the SYSTEM.CURSOR_BLOCK system variable represents depends on the current navigation unit:If the current navigation unit is the bl

【转】shell脚本执行时报"bad interpreter: Text file busy"的解决方法

1)问题现象: 在ubuntu下执行以下脚本( while_count),报错: -bash: ./while_count: /bin/bash: bad interpreter: Text file busy 2)问题原因: This happens because the script file is open for writing, possibly by a rogue process which has not terminated. 3)解决办法: Solution: Check

What is a text file and what is a binary file :)

If you are not coming from a programming background it might not yet be clear what is really a file? What is a binary file and what makes something a text file? 其实总归一句话:[Files that consist exclusively of ASCII characters are known as text ?les. All o

create feature from text file

'''---------------------------------------------------------------------------------- Tool Name: CreateFeaturesFromTextFile Source Name: CreateFeaturesFromTextFile.py Version: ArcGIS 9.1 Author: Environmental Systems Research Institute Inc. Required

shell脚本执行时报"bad interpreter: Text file busy"的解决方法

在执行一个shell脚本时,遇到了"-bash: ./killSession.sh: /bin/bash: bad interpreter: Text file busy"错误提示,如下所示: [[email protected] bin]$ ./killSession.sh      -bash: ./killSession.sh: /bin/bash: bad interpreter: Text file busy 此时只需要在#!/bin/bash,加一空格#! /bin/bas

Error writing temporary file. Make sure your temp folder is valid

NSIS Error:Error writing temporary file. Make sure your temp folder is valid的解决 老婆用了自己的WIN7系统一段时间之后,一直说系统越来越慢,让我帮她重装系统.好吧,那就重装命令呗.幸好我当时给她安装完WIN7之后用GHOST备份了一下.关机,GHOST,等待6分钟...OK,安装完毕.接着就是安装必备软件了,什么360啊,QQ啊,搜狗输入法啊.但是问题来了,不管我安装什么软件,总是报“NSIS Error: "Err

SharePoint 2010: Export User Profile Properties to a Text File or Excel using PowerShell

导出到txt [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server") [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server.UserProfiles") [void][System.Reflection.Assembly]::LoadWithParti