Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

APEX write a text file

WayneMcKinstryMar 1 2017 — edited Mar 1 2017

I need to write a text file from an APEX application. (Release 4.2) I found the code below, but I keep getting the error ORA-29280 invalid
directory path. 

The directoryspecified is a directory for which I have write access.  I made a file in notepad and saved it to this directory.

Maybe I need to be able to browse for the output directory.
Does APEX have a file browse for output files?

What can you tell me?  Thanks.

My code

Declare

   v_input_record   varchar2(600);

   p_dir varchar2(200);

   p_file varchar2(50);

   l_output utl_file.file_type;

   l_amt number default 32000;

cursor
cur_go_thru_AD_INPUT

  is select COUNTY_INPUT_RECORD

  from ad_county_input_file

    order by county_input_file_id_seq;

begin

    p_dir := 'C:\Windows\Temp';

    p_file := 'SoS-Output.asc';

    l_output := utl_file.fopen(p_dir, p_file,
'w', 32767);

  open cur_go_thru_AD_INPUT;

  LOOP

     FETCH cur_go_thru_AD_INPUT

          INTO v_input_record;

     EXIT WHEN cur_go_thru_AD_INPUT%NOTFOUND;

    utl_file.put(l_output, v_input_record );

    utl_file.fflush(l_output);

  END LOOP;

    utl_file.new_line(l_output);

    utl_file.fclose(l_output);

end;

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 29 2017
Added on Mar 1 2017
3 comments
1,610 views