-- 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