Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2003
    Posts
    25

    Unanswered: load data into text file

    Hello there,

    I want to load data from an Oracle table into a text file.
    I have some research and they say by using text_io.
    I try using this one but when I check the .txt file, there is no output.
    Can anybody help me, what is wrong with my code..?


    OPEN_FILE text_io.File_Type;
    LINE_VALUE VARCHAR2(100);
    FILENAME VARCHAR2(15) :='C:\eps_report.txt';
    BEGIN
    OPEN_FILE := text_io.Fopen(FILENAME, 'a');
    LOOP
    text_io.Get_Line(OPEN_FILE, LINE_VALUE);
    text_io.Put(LINE_VALUE);
    text_io.Putf('select * from eps');
    END IF;
    text_io.New_Line(LINE_VALUE);
    END LOOP;
    COMMIT;
    EXCEPTioN
    WHEN no_data_found THEN

    MESSAGE('FILE IS GOING TO CLOSE');
    text_io.Fclose(OPEN_FILE);
    END;


    thanks,
    ynoel

  2. #2
    Join Date
    Jul 2003
    Posts
    12
    You should use the utl_file package, create a directory to locate your text file of output.
    use FOPEN method to open a file for writing, use a cursor to fetch data from table to file.
    It's quite easy to do.
    rgds,

  3. #3
    Join Date
    Jul 2003
    Posts
    12
    You should use the utl_file package, create a directory to locate your text file of output.
    use FOPEN method to open a file for writing, use a cursor to fetch data from table to file.
    It's quite easy to do.
    rgds,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •