UTL_FILE:
Package UTL_FILE permits PL/SQL programs to read and write operating system (OS) text files. It gives a restricted version of standard OS stream file I/O, involving open, get, put and close operations.
When a text file is to be read or written is called, we call the function fopen that returns a file handle for use in subsequent procedure calls. For instance, the procedure put_line writes a text string and line terminator to an open file. A procedure get_line reads a line of text from an open file into an output buffer.
PL/SQL file I/O is available on both the client and server sides. In additional, on the server side and file access is restricted to those directories explicitly listed in the accessible directories list that is stored in the Oracle initialization file.