Content area
Full Text
The Oracle database can create, read and write database files to the server operating file system. The UTL_FILE package lets your PL/SQL programs read and write operating system (OS) text files. It provides a restricted version of standard OS stream file input/output (I / O).
In this article, we'll describe a test PL / SQL block that will test the ability of the UTL_FILE package to write to all operation system files. This PL/SQL block came in handy on a recent project. Our database system read from and wrote to files on various operating system directories. Sometimes the UTL_FILE calls threw exceptions from the code. We used the PL / SQL here to check out directory settings and permissions.
UTL_FILE package
The UTL FILE package owned by SYS provides the basic functionality to read and write operating system files. The file I /0 capabilities are similar to those of the standard operating system stream file I/O (OPEN, GET, PUT and CLOSE), with some limitations. For example, call the FOPEN function to return a file handle, which you then use in subsequent calls to GET_LINE or PUT to perform stream I/O to a file. When you've finished performing I/O on the file, call FCLOSE to complete any output and to free any resources assodated with the file. See Table A on the...