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

Evaluate the following PL/SQL block: DECLARE CURSOR c_1 IS SELECT col_1, col_3 F

ID: 3866792 • Letter: E

Question

Evaluate the following PL/SQL block:

     DECLARE

           CURSOR c_1 IS

                           SELECT     col_1, col_3

                           FROM       tab1

                           ORDER BY c1;

           v_rec      c_1%ROWTYPE;

     BEGIN

           OPEN c_1;

           LOOP

                FETCH c_1 INTO v_rec;

                EXIT WHEN v_rec.col_1 >= 100 OR

                          v_rec.col_1 <= -50 OR

                           c_1%NOTFOUND;

                ......

                DBMS_OUTPUT.PUT_LINE(v_rec%ROWCOUNT);

                DBMS_OUTPUT.PUT_LINE(v_rec.col_3);

                ......

           END LOOP;

           CLOSE c_1;

     END;

Why will the above block cause a syntax error?

A.        The DBMS_OUTPUT.PUT_LINE(v_rec.col_3)statement is illegal.

B.         The DBMS_OUTPUT.PUT_LINE(v_rec%ROWCOUNT)statement is illegal.

C.         The EXIT-WHEN statement is illegal.

D.         The FETCH statement is illegal.

E.         The %ROWTYPE attribute can only be used in reference to actual tables.

Explanation / Answer

Answer:

C. The EXIT-WHEN statement is illegal.

the remaining statements are a legal one. the error will be shown will be at the EXIT-WHEN statement. There is an syntax error in EXIT-WHEN statement.

A.        The DBMS_OUTPUT.PUT_LINE(v_rec.col_3)statement is illegal. - is false

B.         The DBMS_OUTPUT.PUT_LINE(v_rec%ROWCOUNT)statement is illegal. - is false

C.         The EXIT-WHEN statement is illegal. is true

D.         The FETCH statement is illegal. - is false

E.         The %ROWTYPE attribute can only be used in reference to actual tables. - is false

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote