Search code examples
oracle-databaseplsql

PLSQL : Go back to the start of the file after writing


I would like to write inside a file at the start of it everytime. I guess it is something with utl_file.fseek but I dont know how to use it exactely.

Loop
   utl_file.put(my_file, '12345678');
   utl_file.fflush(my_file);
   -- go back to the start to rewrite on the 8 digits number
end loop;

ty


Solution

  • As far as i researched the internet FSEEK can be used only in READ mode.

    You can follow these approches.

    1.You can insert it into a table with serial number and then write to the file the first descending serial number or insert only the last 8 digit number.

    2.You can write it to a file from start to end and then read the file from end and write to a file.