CREATE or replace TYPE tree_ot AS OBJECT(
CUST_ACCOUNT_ID NUMBER(15),
account_name VARCHAR2(240) ,
account_number VARCHAR2(240));
CUST_ACCOUNT_ID NUMBER(15),
account_name VARCHAR2(240) ,
account_number VARCHAR2(240));
create or replace type tree_tt as table of tree_ot;
create or replace function f_tree
return tree_tt pipelined
is
l_retval tree_ot := tree_ot (null, null, null);
begin
for r_dept in (select cust_account_id,account_name,account_number from hz_cust_accounts where rownum<30 )
loop
l_retval.CUST_ACCOUNT_ID :=r_dept.CUST_ACCOUNT_ID;
l_retval.account_name :=r_dept.account_name;
l_retval.account_number :=r_dept.account_number;
pipe row(l_retval);
end loop;
return;
end;
select * from table(f_tree)