View the Exhibit and examine the structure of the EMPLOYEES table.
Examine the following PL/SQL block for storing the salary of all sales representatives from the
EMPLOYEES table in an associative array:
1 DECLARE
2 emp_cv SYS_REFCURSOR;
3 TYPE list IS TABLE OF emp_cv;
4 sals list;
5 BEGIN
6 OPEN emp_cv FOR SELECT salary FROM employees
7 WHERE job_id = ‘SA_REP’;
8 FETCH emp_cv BULK COLLECT INTO sals;
9 CLOSE emp_cv;
10 END;
What should you correct in the above code to ensure that it executes successfully?
A.
Replace EMP_CV in line 3 with employees.salary%TYPE.
B.
Replace line 2 with TYPE refcur IS REF CURSOR; emp_cv refcur;.
C.
Replace BULK COLLECT in line 8 with the OPEN, FETCH, LOOP, and CLOSE statements.
D.
Replace line 2 with TYPE refcur IS REF CURSOR RETURN employees.salary%TYPE;
emp_cv refcur;.
Explanation:
A
A
should be
3 type list is table of employees.salary%type;