UTL_FILE:
UTL_FILE is a package that has
been welcomed warmly by PL/SQL developers. It allows PL/SQL programs to both read
from and write to any operating system files that are accessible from the
server on which your database instance is running.
UTL_FILE Programs:
Subprogram
|
Description
|
Closes a file
|
|
Closes all open
file handles
|
|
Copies a
contiguous portion of a file to a newly created file
|
|
Physically writes
all pending output to a file
|
|
Reads and returns
the attributes of a disk file
|
|
Returns the
current relative offset position within a file, in bytes
|
|
Opens a file for
input or output
|
|
Opens a file in
Unicode for input or output
|
|
Deletes a disk
file, assuming that you have sufficient privileges
|
|
Renames an
existing file to a new name, similar to the UNIX mv function
|
|
Adjusts the file
pointer forward or backward within the file by the number of bytes specified
|
|
Reads text from
an open file
|
|
Reads text in
Unicode from an open file
|
|
Reads a RAW string
value from a file and adjusts the file pointer ahead by the number of bytes
read
|
|
Determines if a
file handle refers to an open file
|
|
Writes one or
more operating system-specific line terminators to a file
|
|
Writes a string
to a file
|
|
Writes a line to
a file, and so appends an operating system-specific line terminator
|
|
Writes a Unicode
line to a file
|
|
Writes a Unicode
string to a file
|
|
A PUT procedure
with formatting
|
|
A PUT_NCHAR procedure
with formatting, and writes a Unicode string to a file, with formatting
|
|
Accepts as input
a RAW data value
and writes the value to the output buffer
|
UTL_FILE Exceptions:
Description
|
|
INVALID_PATH
|
File location is invalid.
|
INVALID_MODE
|
The open_mode parameter in FOPEN is
invalid.
|
INVALID_FILEHANDLE
|
File handle is invalid.
|
INVALID_OPERATION
|
File could not be opened or operated on as requested.
|
READ_ERROR
|
Operating system error occurred during the read operation.
|
WRITE_ERROR
|
Operating system error occurred during the write operation.
|
INTERNAL_ERROR
|
Unspecified PL/SQL error
|
CHARSETMISMATCH
|
A file is opened using FOPEN_NCHAR, but later I/O
operations use nonchar functions such as PUTF or GET_LINE.
|
FILE_OPEN
|
The requested operation failed because the file is open.
|
INVALID_MAXLINESIZE
|
The MAX_LINESIZE value for FOPEN() is
invalid; it should be within the range 1 to 32767.
|
INVALID_FILENAME
|
The filename parameter is invalid.
|
ACCESS_DENIED
|
Permission to access to the file location is denied.
|
INVALID_OFFSET
|
Causes of the INVALID_OFFSET exception: ABSOLUTE_OFFSET = NULL and RELATIVE_OFFSET
= NULL, or ABSOLUTE_OFFSET < 0, or Either offset caused a seek past
the end of the file
|
DELETE_FAILED
|
The requested file delete operation failed.
|
RENAME_FAILED
|
The requested file rename operation failed.
|
Create Directory &
Grant:
SQL>
CREATE DIRECTORY log_dir AS '/appl/gl/log';
SQL>
GRANT READ ON DIRECTORY log_dir TO DBA;
SQL>
CREATE DIRECTORY out_dir AS '/appl/gl/user'';
SQL>
GRANT READ ON DIRECTORY user_dir TO PUBLIC;
No comments:
Post a Comment