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!

How to create pipelined function in bulk collect

User_35O2QOct 25 2022

I have used object-type and nested-type table to bulk collect the first_name,last_name using pipelined function .

create or replace type emp_obj_typ4
as object
(first_name varchar2(3000)
,last_name varchar2(3000));
/

create or replace type emp_typ
is table of emp_obj_typ4;
/

create or replace function dummy_fn return emp_typ pipelined
as
v_first_name varchar2(3000);
v_last_name varchar2(3000);
emp_details emp_typ:=emp_typ( );
begin
emp_details.extend();
select emp_obj_typ4(first_name,last_name) bulk collect into emp_details-----------------using bulk collect without using loop
from employees;
pipe row(emp_details);
return;
end;
/

SQL> show error
Errors for FUNCTION DUMMY_FN:

LINE/COL ERROR
-------- -----------------------------------------------------------------
11/1 PL/SQL: Statement ignored
11/10 PLS-00382: expression is of wrong type
SQL>

i am getting error like this , Is it possible to use pipelined function with the help of bulk collect....if so kindly correct me where i did my mistake....kindly provide me the valid answer

Comments
Post Details
Added on Oct 25 2022
15 comments
2,726 views