Skip to Main Content

DevOps, CI/CD and Automation

How to use cursor in collections , because it is asking me to fetch more number of rows

User_35O2QSep 21 2022

create or replace type fn_typ is table of number;
/
declare
v_department_id fn_typ:=fn_typ(90);
v_first_name varchar2(100);
begin
for i in v_department_id.first..v_department_id.count
loop
select first_name into v_first_name from employees
where department_id =v_department_id(i);
dbms_output.put_line(v_first_name);
end loop;
end;
/
declare
*
ERROR at line 1:
ORA-01422: exact fetch returns more than requested number of rows
ORA-06512: at line 9

it is throwing me error like this,kindly clarify my doubt.

Comments
Post Details
Added on Sep 21 2022
1 comment
48 views