Results 1 to 3 of 3
Thread: Utl_file with zero bytes
12-24-12, 07:40 #1Registered User
- Join Date
- Jan 2004
Unanswered: Utl_file with zero bytes
I have the below requirement:
I have an oracle piece of code which access (open the file in 'Read' Mode) a flat file and read the file to insert data into Oracle table. My requirement is, if the flat file size is zero bytes than do not proceed further.
Thanks with Regards,
12-24-12, 10:19 #2Registered User
- Join Date
- Aug 2003
- Where the Surf Meets the Turf @Del Mar, CA
You won't know it contains 0 bytes until after you try to actually read it.You can lead some folks to knowledge, but you can not make them think.
The average person thinks he's above average!
For most folks, they don't know, what they don't know.
There are no stupid questions, but there are a LOT of Inquisitive Idiots.
The nice thing about being senile is you can hide your own Easter eggs.
12-24-12, 15:01 #3Registered User
- Join Date
- Feb 2006
This procedure reads text from the open file identified by the file handle and places the text in the output buffer parameter. Text is read up to, but not including, the line terminator, or up to the end of the file, or up to the end of the len parameter. It cannot exceed the max_linesize specified in FOPEN.
UTL_FILE.GET_LINE ( file IN FILE_TYPE, buffer OUT VARCHAR2, len IN PLS_INTEGER DEFAULT NULL); Parameters
Table 168-14 GET_LINE Procedure Parameters
Parameters Description file
Active file handle returned by an FOPEN call.
The file must be open for reading (mode r); otherwise an INVALID_OPERATION exception is raised.
Data buffer to receive the line read from the file.
The number of bytes read from the file. Default is NULL. If NULL, Oracle supplies the value of max_linesize.
If the line does not fit in the buffer, a VALUE_ERROR exception is raised. If no text was read due to end of file, the NO_DATA_FOUND exception is raised. If the file is opened for byte mode operations, the INVALID_OPERATION exception is raised.
Because the line terminator character is not read into the buffer, reading blank lines returns empty strings.
The maximum size of the buffer parameter is 32767 bytes unless you specify a smaller size in FOPEN.If unspecified, Oracle supplies a default value of 1024. See also "GET_LINE_NCHAR Procedure".
INVALID_FILEHANDLE INVALID_OPERATION READ_ERROR NO_DATA_FOUND VALUE_ERROR