Over 10 Million Study Resources Now at Your Fingertips

Download as :
Rating : ⭐⭐⭐⭐⭐
Price : $10.99
Pages: 2

Open once youve created the directory

Following are some examples:

• In Windows:

Working with Oracle Directories

Prior to Oracle9i Database Release 2, whenever you opened a file, you needed to specify the location of the file, as in the preceding examples. Such a hardcoding of values is always to be avoided, however. What if the location of the accounts data changes? How many programs will you have to fix to make sure everyone is looking in the right place? How many times will you have to make such changes?

CONSTANT VARCHAR2(30) := '/accts/data';


file_id := UTL_FILE.fopen (accts_pkg.c_data_location, 'trans.dat', 'R');


Reading and Writing Files | 931

Here are some things to keep in mind about directories and UTL_FILE:

• The Oracle database does not validate the location you provide when you specify the name of a directory. It simply associates that string with the named database object.

• Once you’ve created the directory, you can grant specific users permission to work with it as follows:

GRANT READ ON DIRECTORY development_dir TO senior_developer;

Before you can read or write a file, you must open it. The UTL_FILE.FOPEN function opens the specified file and returns a file handle you can then use to manipulate the file.

Here’s the header for the function:

932 |
How It Works
Login account
Login Your Account
Add to cart
Add to Cart
Make payment
Document download
Download File
PageId: ELIE7FED51
Uploaded by :
Page 1 Preview
open once youve created the directory
Sell Your Old Documents & Earn Wallet Balance