Professional Documents
Culture Documents
Functions With Return Type Collection S
Functions With Return Type Collection S
loop
display(v_t(i).vname);
end loop;
end;
CREATE OR REPLACE PACKAGE my_pkg IS
TYPE t_col IS RECORD(
i NUMBER,
n VARCHAR2(30));
TYPE t_nested_table IS TABLE OF t_col;
FUNCTION return_table RETURN t_nested_table PIPELINED;
END my_pkg;
CREATE OR REPLACE PACKAGE BODY my_pkg IS
FUNCTION return_table RETURN t_nested_table PIPELINED IS
l_row t_col;
BEGIN
l_row.i := 1;
l_row.n := 'one';
PIPE ROW(l_row);
l_row.i := 2;
l_row.n := 'two';
PIPE ROW(l_row);
RETURN;
END;
END my_pkg;
create or replace function f (veno temp.empno%type)
return t
pipelined
is
v obj:=obj(1,'a');
begin
v.veno:=veno;
select ename into v.vname from temp where empno=veno;
pipe row(v);
return;
end;
create or replace function f (veno temp.empno%type)
return t
pipelined
is
v obj:=obj(1,'a');
begin
v.veno:=veno;
select ename into v.vname from temp where empno=veno;
pipe row(v);
return;
end;