Home » SQL & PL/SQL » SQL & PL/SQL » UTL_FILE: Need to reinitialize the file pointer to first position
UTL_FILE: Need to reinitialize the file pointer to first position [message #321445] Tue, 20 May 2008 05:11 Go to next message
rak007
Messages: 107
Registered: October 2006
Location: Mumbai / Pune, India
Senior Member
I am opening a file using utl_file.fopen and need to check whether the file is blank or not. In case it is blank it should come out of the package.
In case file is not blank then i need to place the file pointer back to the first position in the file as it was when i opened the file with fopen. What can i do to achieve this ?

One option is closing the file and again opening but i feel this is not a good programming practice.

Using fseek we can seek forward or backward in a file. So this can be helpful but i dont know how
Re: UTL_FILE: Need to reinitialize the file pointer to first position [message #321452 is a reply to message #321445] Tue, 20 May 2008 05:31 Go to previous messageGo to next message
tahpush
Messages: 961
Registered: August 2006
Location: Stockholm/Sweden
Senior Member

Quote:
place the file pointer back to the first position

Too my knowledge you cant do that.

fseek is only for reading, top -> bottom or bottom->top
Re: UTL_FILE: Need to reinitialize the file pointer to first position [message #321455 is a reply to message #321452] Tue, 20 May 2008 05:44 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
You should be able to use
UTL_FILE.FSEEK(file_type,1)
- this should send you to the 1st byte in the file.

Read the Documentation
Previous Topic: control spooled html output
Next Topic: Assign column Value to another variable
Goto Forum:
  


Current Time: Fri Dec 02 16:46:09 CST 2016

Total time taken to generate the page: 0.09504 seconds