create or replace type obj_cdm_type as object
(id number,name varchar2(250));
create or replace type obj_cdm_t is table of obj_cdm_type;
create or replace function obj_cdm_fun(pid number) return obj_cdm_t PIPELINED
as
l_obj_cdm_type obj_cdm_type:=obj_cdm_type(null,null);
cursor cur is select id,name from student;
type t_cur is table of cur%rowtype index by pls_integer;
r_cur t_cur;
begin
open cur;
fetch cur bulk collect into r_cur;
close cur;
for idx in 1 .. r_cur.count
loop
l_obj_cdm_type.id :=r_cur(idx).id;
l_obj_cdm_type.name :=r_cur(idx).name;
pipe row(l_obj_cdm_type);
end loop;
end;
No comments:
Post a Comment