Examine the following PL/SQL code:
The server output is on for the session. Which statement is true about the execution of the code?
A.
The code executes successfully and gives the desired output.
B.
The code generates an error because the EMP_RECORD variable is not declared.
C.
The code generates an error because the cursor is not opened before the FOR loop.
D.
The code generates an error because the loop does not have the exit when clause.
A
A
a
A
A
DECLARE CURSOR c_emp_cursor IS
SELECT employee_id, JOB_ID, LAST_NAME from EMPLOYEES;
BEGIN
FOR er IN c_emp_cursor
LOOP
dbms_output.put_line (er.employee_id || ‘ ‘ || er.LAST_NAME);
END LOOP;
END;
/
output:
11 b
/
Even though the ‘er’ variable is not declared,
thhecode executes successfully and gives the desired output
Even though the EMP_RECORD variable is not declared,
the code executes successfully and gives the desired output.
because EMP_RECORD is a loop counter variable.
FOR loop_counter IN [REVERSE] lowest_number..highest_number
LOOP
{…statements…}
END LOOP;
A
Here are a number of the websites we advocate for our visitors.