oracle管道函数(pipelined)

--首先定义类型,管道函数可以返回多行数据,所以不能使用基础数据类型。
create or replace type my_type as table of varchar2(4000);

--创建管道函数
--管道函数关键字: "[b]pipelined[/b]"
--管道函数返回一行使用:"[b]pipe row(...)[/b]"
create or replace function func_pipe_test return my_type
  pipelined is
begin
  for i in reverse 1 .. 10 loop
    pipe row(i);
  end loop;

end;

--使用管道函数
select * from table(func_pipe_test);

你可能感兴趣的:(oracle,sql)