Answers for "write to file plsql"

SQL
1

write to file plsql

DECLARE
   path_file          varchar2(100):='/path/to/directory/';
   file_name          varchar2(100):='file_name.txt';
   out_file           utl_file.file_type;
BEGIN
   out_file := utl_file.fopen(path_file,file_name,'w');
   UTL_FILE.put_line (out_file, 'Line 1');
   UTL_FILE.put_line (out_file, 'Line 2');
   UTL_FILE.FCLOSE(out_file);
EXCEPTION
  WHEN OTHERS THEN
    IF UTL_FILE.is_open(out_file) THEN
      UTL_FILE.fclose(out_file);
    END IF;
END;
Posted by: Guest on June-17-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language