create or replace type Ty_Util_Master as object (
id number,
txn_date date);
Type created.
create or replace type Ty_Utils_Detail as object (
seq_no number,
amt number,
txn_type varchar2(3));
Type created.
create or replace type Ty_Tb_Utils_Details as table of Ty_Utils_Detail;
Type created.
create or replace package tst as
type pl_Ty_Util is record (
header Ty_Util_Master
, details Ty_Tb_Utils_Details
);
procedure process_utils ( p_util in pl_Ty_Util);
end tst;
Package created.
create or replace package body tst as
procedure process_utils
( p_util in pl_Ty_Util)
is
begin
dbms_output.put_line('id = '||p_util.header.id);
for idx in ( select t.*
from table(p_util.details) t
order by t.seq_no nulls last)
loop
dbms_output.put_line('#'||idx.seq_no ||' '|| idx.amt ||' '|| idx.txn_type );
end loop;
end process_utils;
end tst;
Package created.
declare
l_utils tst.pl_Ty_Util;
begin
l_utils := tst.pl_Ty_Util(Ty_Util_Master(42, sysdate)
, Ty_Tb_Utils_Details(
Ty_Utils_Detail(3, 3000, 'D')
, Ty_Utils_Detail(null, 275, 'C')
, Ty_Utils_Detail(1, 5000, 'C')
, Ty_Utils_Detail(4, 150, 'D')
, Ty_Utils_Detail(2, 2000, 'C')
)
);
tst.process_utils(l_utils);
end;
id = 42
#1 5000 C
#2 2000 C
#3 3000 D
#4 150 D
# 275 C