Home » SQL & PL/SQL » SQL & PL/SQL » UTL_FILE overwrites data (TOAD for Oracle)
UTL_FILE overwrites data [message #337680] Thu, 31 July 2008 11:13 Go to next message
AlKing
Messages: 11
Registered: July 2008
Location: Bakersfield
Junior Member
Guys,
I am trying to write multiple files with multiple lines in each file using UTL_FILE utility package. These files will be named with ID grabbed from cursor(Cursor 1 in code).
This code does write multiple files and names the file name correctly. The only problem is in each file there are supposed to be multiple lines and it seems to overwrite all of these lines and it only input the header and the last line of data grabbed from cursor 2.

I need a condition that says write all the lines first on the first file before moving to the next file. Data in each file are unique by the way. See attached for the code. Please help.
  • Attachment: al.txt
    (Size: 2.84KB, Downloaded 180 times)
Re: UTL_FILE overwrites data [message #337681 is a reply to message #337680] Thu, 31 July 2008 11:19 Go to previous messageGo to next message
BlackSwan
Messages: 25036
Registered: January 2009
Location: SoCal
Senior Member
http://www.orafaq.com/forum/t/88153/0/
Please read & follow posting guidelines as stated in URL above


Why are you using PUTF & not PUT_LINE?
Re: UTL_FILE overwrites data [message #337682 is a reply to message #337680] Thu, 31 July 2008 11:25 Go to previous message
AlKing
Messages: 11
Registered: July 2008
Location: Bakersfield
Junior Member
Actually you were right. I figure out my problem, I was opening and closing the file everytime that was the problem. That worked but it was still printing the heading multiple times, so I changed it to PUT_LINE like you said and now it works...thanks a lot for raising that question....its my first time using UTL_FILE and I thought the only difference between PUTF and PUT_LINE was PUTF put data with format...thanks a bunch
Previous Topic: Fetching Cursor problem
Next Topic: table update error
Goto Forum:
  


Current Time: Sun Dec 04 00:50:04 CST 2016

Total time taken to generate the page: 0.10318 seconds