반응형
oracle table fuction
1. object
create or replace type type_object as object
(
aaa varchar2(10),
bbb varchar2(10),
ccc varchar2(10)
)
2. table
create or replace type type_table as table of type_object
3. function
CREATE OR REPLACE FUNCTION fn_type_test
(
ps_no1 number,
ps_no2 number
)
return type_table
is
v_table type_table := type_table();
BEGIN
for i in ps_no1..ps_no2
loop
v_table.extend;
v_table(i) := type_object(i,i,i);
end loop;
return v_table;
end;
결과
select * from table(fn_type_test(1,3));
aaa bbb ccc
1 1 1
2 2 2
3 3 3
반응형
'Oracle(DB관련)' 카테고리의 다른 글
oracle 주간 일요일~월요일, 전년 동요일 (0) | 2017.07.07 |
---|---|
oracle select update (0) | 2017.06.15 |
oracle SYS_CONTEXT (0) | 2016.12.05 |
oracle plsql debugging (0) | 2016.12.05 |
sqlplus -prelim (0) | 2014.08.11 |