Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating text files

Status
Not open for further replies.

jbenh

IS-IT--Management
Dec 2, 2002
21
0
0
US
I need to create a text file from production data using PL/SQL on Oracle 8i on HPUX v11. A quick search of OTN was no luck.

Thanks,

Ben
 
DECLARE
L_STR VARCHAR2(4000);
L_OUTPUT UTL_FILE.FILE_TYPE;
BEGIN
L_OUTPUT := UTL_FILE.FOPEN('d:\','test.txt', 'W');
L_STR := 'Sample test message to file';
UTL_FILE.PUT_LINE(L_OUTPUT,L_STR);
UTL_FILE.FCLOSE( L_OUTPUT );
EXCEPTION
WHEN OTHERS THEN
UTL_FILE.FCLOSE( L_OUTPUT );
END;


Note: give the directory permission in init.ora file by setting the utl_file_dir variable.

-Sudhi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top