This shows you the differences between two versions of the page.
kurs:pipelined_functions_in_packages_mit_table_of_record_return [2014/09/10 21:22] |
kurs:pipelined_functions_in_packages_mit_table_of_record_return [2014/09/10 21:22] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | <code> | ||
+ | CREATE OR REPLACE | ||
+ | PACKAGE return_recordtable | ||
+ | IS | ||
+ | cursor c_emp(c_p_salary number) is | ||
+ | select first_name, last_name, salary fullname from emp | ||
+ | where salary < c_p_salary; | ||
+ | |||
+ | type t_emp is table of c_emp%rowtype; | ||
+ | | ||
+ | FUNCTION MAX_SALARY_PIPE | ||
+ | ( p_sal_max IN number) | ||
+ | RETURN t_emp pipelined ; | ||
+ | END; -- Package spec | ||
+ | / | ||
+ | |||
+ | |||
+ | CREATE OR REPLACE | ||
+ | PACKAGE BODY return_recordtable | ||
+ | IS | ||
+ | |||
+ | FUNCTION MAX_SALARY_PIPE | ||
+ | ( p_sal_max IN number) | ||
+ | RETURN t_emp pipelined IS | ||
+ | | ||
+ | BEGIN | ||
+ | for r in c_emp(p_sal_max) loop | ||
+ | pipe row(r); | ||
+ | end loop; | ||
+ | END; | ||
+ | END; | ||
+ | / | ||
+ | </code> |