Home » SQL & PL/SQL » SQL & PL/SQL » writting to a text file
writting to a text file [message #196874] Sun, 08 October 2006 23:07 Go to next message
sujeethbala
Messages: 25
Registered: October 2006
Location: INDIA
Junior Member
hi all

i have a cursor for loop

for i in curnames
loop
dbms_output.put_line(i.name);
--(instead of this i want to
--insert this result into a text file. how to open a text file and
--write to it)
end loop;

thanks
Re: writting to a text file [message #196877 is a reply to message #196874] Mon, 09 October 2006 00:03 Go to previous messageGo to next message
Littlefoot
Messages: 20888
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
There's a possibility to spool the output into a text file (using SPOOL text_file.txt at the beginning and SPOOL OFF at the end; don't forget about SET SERVEROUTPUT ON (size). Another way would be using the UTL_FILE package.
Re: writting to a text file [message #196879 is a reply to message #196877] Mon, 09 October 2006 00:25 Go to previous messageGo to next message
sujeethbala
Messages: 25
Registered: October 2006
Location: INDIA
Junior Member
hi
can u give me the e.g what is the syntax and how to insert text
into it. thanks for reply.

Re: writting to a text file [message #196881 is a reply to message #196879] Mon, 09 October 2006 00:35 Go to previous messageGo to next message
Littlefoot
Messages: 20888
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I can do even better - here's another page for you to read and have an interesting day trying those examples and syntax all day long.

[EDIT] I apologize for giving the illegal source of O'Reilly's online book; although I didn't notice this fact, it is a poor excuse. Now the link points to a legal page.

[Updated on: Mon, 09 October 2006 01:27]

Report message to a moderator

Re: writting to a text file [message #196883 is a reply to message #196881] Mon, 09 October 2006 00:45 Go to previous messageGo to next message
sujeethbala
Messages: 25
Registered: October 2006
Location: INDIA
Junior Member
Littlefoot wrote on Mon, 09 October 2006 11:05

I can do even better - here's another page for you to read and have an interesting day trying those examples and syntax all day long.



thanks buddy. its really a good page.


[mod-ed]updated link.

[Updated on: Mon, 09 October 2006 01:31] by Moderator

Report message to a moderator

Re: writting to a text file [message #196888 is a reply to message #196883] Mon, 09 October 2006 01:05 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
This is the same chapter from a legal source.
Re: writting to a text file [message #196891 is a reply to message #196888] Mon, 09 October 2006 01:20 Go to previous message
Littlefoot
Messages: 20888
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Was it illegal? I'm sorry, it wasn't my intention to distribute illegal resources. I just picked it up from Google.
Previous Topic: Which is the best cursor loop for ETL with large no of columns
Next Topic: Lock row
Goto Forum:
  


Current Time: Fri Dec 02 13:48:06 CST 2016

Total time taken to generate the page: 0.30670 seconds