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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exporting into text file

Status
Not open for further replies.

draganp

Programmer
May 29, 2000
8
CA
Hi,<br><br>I'm trying to export the result of my SELECT<br>statement into .txt file. Can anybody gave any hint how to do that ?<br><br>Thanks
 
declare a file variable:<br>&nbsp;&nbsp;out_file&nbsp;&nbsp;TEXT_IO.FILE_TYPE;<br>...<br>open it:<br>out_file := TEXT_IO.FOPEN('C:\TEMP\FOO.TXT','W');&nbsp;&nbsp;(or 'A' to append)<br><br>do your select into var1, var2...<br>create a text string:<br>text := var1 ¦¦ var2 ¦¦&nbsp;&nbsp;(use delimiters if you need: ¦¦ ',' ¦¦<br><br>write to it:<br>&nbsp;&nbsp;TEXT_IO.PUT_LINE(out_file,text);<br>&nbsp;&nbsp;TEXT_IO.NEW_LINE;<br><br>close it:<br>&nbsp;&nbsp;TEXT_IO.FCLOSE(out_file);
 
I found out that it is also possible to do that from utl_file package using the same functions.<br><br>Thank you !!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top