Oracle PLSQL Demo - 19.管道function[查询整表组成list管道返回]

create or replace function function_demo RETURN emp

            PIPELINED as

    Type ref_cur_emp IS REF CURSOR RETURN emp%RowType;

    cur_emp ref_cur_emp;

    rec_emp cur_emp%RowType;

begin

    Open cur_emp For

        select * from emp t;

    Loop

        fetch cur_emp

            InTo rec_emp;

        Exit When cur_emp%NotFound;

        PIPE ROW(rec_emp);

    End Loop;

    Close cur_emp;

end function_demo;

 

你可能感兴趣的:(function)