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.
I also think that correct answer is A.
Code runs successfully:
set serveroutput on;
declare
cursor c_emp_cursor is
select employee_id,last_name from employees
where department_id=30;
begin
for emp_record in c_emp_cursor
loop
dbms_output.put_line(emp_record.employee_id||’ ‘ ||emp_record.last_name);
end loop;
end;
/
114 Raphaely
115 Khoo
116 Baida
117 Tobias
118 Himuro
119 Colmenares
PL/SQL procedure successfully completed.