Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Database Administration Set echo on Set SERVEROUT ON FORMAT TRUNCATED Set up a s

ID: 3741507 • Letter: D

Question

Database Administration

Set echo on

Set SERVEROUT ON FORMAT TRUNCATED

Set up a spool file to receive your output for submission. I would suggest c:cs423S3project2spool.txt

Create a copy of c:cs423S2project1.txt as c:cs423S3project2.txt and change the DECLARE block to a CREATE OR REPLACE PROCEDURE named DDI.DISPLAY_ROOMCNT

Modify the loop to use a cursor

Compile and run your report

(If there are errors, SHOW ERRORS to see what needs to be corrected)

Run the procedure using the SQL EXEC statement. The result should be the same as last week

Close the spool file

Explanation / Answer

ANS:-

  

CREATE PROCEDURE DDI.DISPLAY_ROOMCNT

IS

l_file UTL_FILE.file_type;

l_file_name VARCHAR2 (60);

BEGIN

Set echo on

Set SERVEROUT ON FORMAT TRUNCATED

l_file := UTL_FILE.fopen ('UTL_DIR', l_file_name, 'w');

END;

EXECUTE DDI.DISPLAY_ROOMCNT (UTL_FILE.FOPEN,'c:cs423S3project2spool.txt');

CREATE OR REPLACE PROCEDURE DDI.DISPLAY_ROOMCNT

IS

l_file UTL_FILE.file_type;

l_file_name VARCHAR2 (60);

BEGIN

l_file := UTL_FILE.fopen ('UTL_DIR', l_file_name, 'w');

UTL_FILE.putf (l_file, l_file_name);

UTL_FILE.fclose (l_file);

END DDI.DISPLAY_ROOMCNT;

EXECUTE DDI.DISPLAY_ROOMCNT(UTL_FILE.FOPEN,'c:cs423S3project2.txt');