PROCEDURE CREATE_FLAT_FILE IS --============================================================================ -- Copywright 2002: Victor R. Jaen G., Pannama Canal Authority, -- E-Mail: vjaen@pancanall.com --============================================================================= -- DESCRIPTION -- Simple procedure to write to a text fille from a form -- NOTES -- Call this procedure from the WHEN-BBUTTON-PRESSED trigger -- REQUIREMENTS -- Must have access to local drives -- --============================================================================= -- MODIFICATION HISTORY -- Person Date Comments -- --------- ---------- -------------------------------------------- -- Victor 10/29/2002 Initial Submissioon to OracleTricks.com --============================================================================= in_file TEXT_IO.FILE_TYPE; linebuf VARCHAR2(80); your_file VARCHAR2(50) := 'C:\TEMP\your_file.dat'; text_line VARCHAR2(400); BEGIN in_file := TEXT_IO.FOPEN(your_file, 'W'); GO_BLOCK('YOUR_DATA_BLOCK'); FIRST_RECORD; LOOP IF :your_checkbox = 'Y' THEN text_line := LPAD(:your_item1, 10, ' ')|| LPAD(:your_item2, 20, ' ')|| LPAD(:your_item3, 30, ' ')|| LPAD(:your_item4, 50, ' '); -- TEXT_IO.PUT_LINE(in_file, text_line); END IF; -- exit when :SYSTEM.LAST_RECORD = 'TRUE'; NEXT_RECORD; END LOOP; -- TEXT_IO.FCLOSE(in_file); EXCEPTION WHEN NO_DATA_FOUND THEN TEXT_IO.FCLOSE(in_file); END;