create type row_typeas
object(a varchar2(10), vvarchar2(10));--定义行对象 create type table_typeastableof row_type;
--定义表对象 createorreplacefunction test_fun(
ainvarchar2,binvarchar2
) return table_type pipelined is
v row_type;--定义v为行对象类型 begin for thisrow
in (select a, bfrom mytable
where col1=aand col2
= b) loop
v := row_type(thisrow.a, thisrow.b); pipe row (v); end loop; return; end; select*fromtable(test_fun(‘123‘,‘456‘));