Search This Blog

Thursday, August 9, 2018

Text Generation by PL/SQL

-- Create directory 
create or replace directory EXPIMP_DIR  as 'E:\hira';

--PL/SQL Block

DECLARE
v_file  UTL_FILE.FILE_TYPE;
BEGIN
  v_file := UTL_FILE.FOPEN(location     => 'EXPIMP_DIR',
                           filename     => 'New_Card_Test.txt',
                           open_mode    => 'w',
                           max_linesize => 32767);
                           
  FOR cur_rec IN (select sl,data_desc from tt order by sl) LOOP
  
    UTL_FILE.PUT_LINE(v_file,cur_rec.data_desc);
  
  END LOOP;
  UTL_FILE.FCLOSE(v_file);
    
EXCEPTION
  WHEN OTHERS THEN UTL_FILE.FCLOSE(v_file); RAISE;
END;

No comments:

Post a Comment

Restrict File Upload by File Type in Oracle Apex

If you want to restrict file upload by file type/extension/format you can follow the below steps.  Goto File Browser Item --> Advanced --...