/temp/my_files is an existing folder in the server, facultylist.txt is an existing text file in this folder.
Examine the following commands that are executed by the DBA:
SQL > CREATE DIRECTION my_dir AS '/temp/my_files';
SQL > GRANT READ ON DIRECTORY my_dir To public:
View the Exhibit and examine the procedure created by user SCOTT to read the list of faulty names from the text file:
CREATE OR REPLACE PROCEDURE read_files (dirname VARCHAR2,txtfile VARCHAR2) IS
f_file UTL_FILE.FILE_TYPE;
v_buffer VARCHAR2(200);
BEGIN
f_file := UTL_FILE.FOPEN (dirname,txtfile,'R');
LOOP
UTL_FILE.GET_LINE(f_file,v_buffer);
DBMS_OUTPUT.PUT_LINE(v_buffer);
END LOOP;
UTL_FILE.FCLOSE(f_file);
END read_file;
/
SCOTT executes the procedure as follows
SQL > SET SERVEROUTPUT ON
SQL > EXEC read_file('MY_DIR',FACULTYLIST.TXT')
What is the outcome?
/temp/my_files is an existing folder in the server, facultylist.txt is an existing text file in this folder.
Examine the following commands that are executed by the DBA:
SQL > CREATE DIRECTION my_dir AS '/temp/my_files';
SQL > GRANT READ ON DIRECTORY my_dir To public:
View the Exhibit and examine the procedure created by user SCOTT to read the list of faulty names from the text file:
CREATE OR REPLACE PROCEDURE read_files (dirname VARCHAR2,txtfile VARCHAR2) IS
f_file UTL_FILE.FILE_TYPE;
v_buffer VARCHAR2(200);
BEGIN
f_file := UTL_FILE.FOPEN (dirname,txtfile,'R');
LOOP
UTL_FILE.GET_LINE(f_file,v_buffer);
DBMS_OUTPUT.PUT_LINE(v_buffer);
END LOOP;
UTL_FILE.FCLOSE(f_file);
END read_file;
/
SCOTT executes the procedure as follows
SQL > SET SERVEROUTPUT ON
SQL > EXEC read_file('MY_DIR',FACULTYLIST.TXT')
What is the outcome?