Which two statements are true about the usage of the cursor for loops?

Which two statements are true about the usage of the cursor for loops? (Choose two.)
A. The cursor needs to be closed after the iteration is complete.
B. The implicit open, fetch, exit, and close of the cursor happen.
C. The record type must be explicitly declared to control the loop.
D. The PL/SQL creates a record variable with the fields corresponding to the columns of the cursor result set.

Download Printable PDF. VALID exam to help you PASS.

2 thoughts on “Which two statements are true about the usage of the cursor for loops?

  1. https://docs.oracle.com/cd/E11882_01/appdev.112/e25519/cursor_for_loop_statement.htm#LNPLS1155

    “The cursor FOR LOOP statement implicitly declares its loop index as a record variable of the row type that a specified cursor returns, and then opens a cursor. With each iteration, the cursor FOR LOOP statement fetches a row from the result set into the record. When there are no more rows to fetch, the cursor FOR LOOP statement closes the cursor. The cursor also closes if a statement inside the loop transfers control outside the loop or raises an exception.”

    Example:

    BEGIN
    FOR item IN (
    SELECT last_name, job_id
    FROM employees
    WHERE job_id LIKE ‘%CLERK%’
    AND manager_id > 120
    ORDER BY last_name
    )
    LOOP
    DBMS_OUTPUT.PUT_LINE
    (‘Name = ‘ || item.last_name || ‘, Job = ‘ || item.job_id);
    END LOOP;
    END;
    /

Leave a Reply

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


The reCAPTCHA verification period has expired. Please reload the page.