Examine this code:
The anonymous block fails this error stack:
Which two changes, when separately applied, would prevent these errors from occurring?
A. Define v2 as employees%ROWTYPE.
B. Initialize v1 and v2 with appropriate constructor functions.
C. Define v2 as pkg. rec.
D. Nothing because using the function TABLE (V1) is prohibited.
E. Define v1 as employees%ROWTYPE.
A option not working
AC
AC
create or replace package pkg as
type rec is record (f1 number, f2 varchar2(20));
type mytab is table of rec index by PLS_INTEGER;
end pkg;
/
declare
v1 pkg.mytab;
–v2 employees%ROWTYPE; –a
v2 pkg.rec; — c
c1 sys_refcursor;
begin
for i in 100..200 loop
select employee_id, last_name into v1(i)
from employees where employee_id = i;
end loop;
open c1 for select * from table(v1);
fetch c1 into v2;
close c1;
end;
/
A option not working
PKG.REC structure is the same like EMPLOYEES table, thus true are A and C.