Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

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

User_35O2QSep 23 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 23 2022
3 comments
86 views