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 pubiic:
View the Exhibit and examine the procedure created by user SCOTT to read the list of faculty
names from the text 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 pubiic:
View the Exhibit and examine the procedure created by user SCOTT to read the list of faculty
names from the text file.

SCOTT executes the procedure as follows:
SQL>SET SERVEROUTPUT ON
SQL>EXEC read_file (‘MY_DIR’, FACULTYLIST.TXT’)
What is the outcome?

A.
It goes into an infinite loop.

B.
It executes successfully and displays only the list of faculty names.

C.
It does not execute and displays an error message because the end-of-file condition is not
taken care of.

D.
It executes successfully and displays the list of faculty names followed by a “no data found”
error message.

Explanation:



Leave a Reply 12

Your email address will not be published. Required fields are marked *


vishesh bansal

vishesh bansal

d,

no data found at last..after printing the list of faculty

samkelo siyabonga ngubo

samkelo siyabonga ngubo

D

Piero

Piero

ops SURPRISE

ITS’NT TRUE

THE RIGHT ANSWER IS B
ELSEWHERE IS OMITTED EOF… IT ENDS CORRECTLY WITHOUT ERRORS MESSAGES

–ORACLE_HOME = E:\oraclexe\app\oracle\product\11.2.0\server
CREATE DIRECTORY CEPROVAMO AS ‘E:\oraclexe\app\oracle\product\11.2.0\server\AAA’;

DECLARE
FILEIO utl_file.file_type;
vNewLine VARCHAR2(250) := ‘CE LAEMO FATTA’;
BEGIN
FILEIO := utl_file.fopen(‘CEPROVAMO’, ‘OUT.TXT’, ‘W’);
utl_file.PUT_line(FILEIO, vNewLine);
dbms_output.put_line(vNewLine);
utl_file.fclose(FILEIO);
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line(‘WHEN OTHERS’);

END fopen;

BEGIN
utl_file.fcopy(
src_location => ‘CEPROVAMO’,
src_filename => ‘OUT.TXT’,
dest_location => ‘CEPROVAMO’,
dest_filename => ‘OUTCOPY.TXT’,
start_line => 1,
end_line => 50
);
END;

DECLARE
f_file utl_file.file_type;
v_buffer VARCHAR2(200);
BEGIN
f_file := utl_file.fopen(‘CEPROVAMO’, ‘OUTCOPY.txt’, ‘R’);
— f_file := utl_file.fopen(‘c:/temp’, ‘xyz.txt’, ‘r’);
— f_file := utl_file.fopen(‘c:\temp’, ‘xyz.txt’, ‘r’);
LOOP
BEGIN
utl_file.get_line(f_file, v_buffer);
dbms_output.put_line(v_buffer);
EXCEPTION
WHEN OTHERS THEN
EXIT;
END;
END LOOP;
utl_file.fclose(f_file);
END ;

Piero

Piero

NO, SORRY IF YOU DON’T HANDLE EXCEPTION OBTAIN ERROR, BUT ALSO YOU DON’T OBTAINS THE LIST

IT SEEMS TO BE C THE RIGHT ANSWER

ANY OTHER OPINION PLEASE ?

DECLARE
f_file utl_file.file_type;
v_buffer VARCHAR2(200);
BEGIN
f_file := utl_file.fopen(‘CEPROVAMO’, ‘OUTCOPY.txt’, ‘R’);
— f_file := utl_file.fopen(‘c:/temp’, ‘xyz.txt’, ‘r’);
— f_file := utl_file.fopen(‘c:\temp’, ‘xyz.txt’, ‘r’);
LOOP
BEGIN
utl_file.get_line(f_file, v_buffer);
dbms_output.put_line(v_buffer);
————————————- EXCEPTION
————————————- WHEN OTHERS THEN
——————————————– EXIT;
END;
END LOOP;
utl_file.fclose(f_file);
END ;

ORA-01403: no data found
ORA-06512: at “SYS.UTL_FILE”, line 106
ORA-06512: at “SYS.UTL_FILE”, line 746
ORA-06512: at line 10

SH

SH

Yes, C correct answer.

caadecarvalho

caadecarvalho

C is the correct answer, you haven’t SET SERVEROUTPUT ON. Please take a look on the test mentioned below:

oracle@HOST01:/oracle/tmp > cat TEST.LOG
LALA
BLABLA
oracle@HOST01:/oracle/tmp > cat RUN.sql
SET SERVEROUTPUT ON
DECLARE
FILE UTL_FILE.FILE_TYPE;
V_BUFFER VARCHAR2(200);
BEGIN
FILE := UTL_FILE.FOPEN(‘TMP2′,’TEST.LOG’,’R’);
LOOP
UTL_FILE.GET_LINE(FILE, V_BUFFER);
DBMS_OUTPUT.PUT_LINE(V_BUFFER);
END LOOP;
END;
/
EXIT
oracle@HOST01:/oracle/tmp > sqlplus -S / as sysdba @RUN
LALA
BLABLA
DECLARE
*
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at “SYS.UTL_FILE”, line 106
ORA-06512: at “SYS.UTL_FILE”, line 746
ORA-06512: at line 7

Regards

giosefer

giosefer

The correct answer is D.

Valts

Valts

Hi! Can someone send me the latest dumps please? I am taking the exam next week. My email – [email protected]
Thank you in advance!