SQL>
SQL> CREATE OR REPLACE FUNCTION fopen
2 (loc_in IN VARCHAR2,
3 file_in IN VARCHAR2,
4 mode_in IN VARCHAR2 := 'R')
5 RETURN UTL_FILE.FILE_TYPE
6 IS
7 fID UTL_FILE.FILE_TYPE;
8 BEGIN
9 fID := UTL_FILE.FOPEN (loc_in, file_in, mode_in);
10 RETURN fid;
11 EXCEPTION
12 WHEN UTL_FILE.INVALID_OPERATION
13 THEN
14 IF mode_in = 'A'
15 THEN
16 fID := UTL_FILE.FOPEN (loc_in, file_in, 'W');
17 RETURN fid;
18 ELSE
19 RAISE;
20 END IF;
21 END;
22 /
SQL>
|