日期:2014-05-17 浏览次数:20745 次
包头: create or replace package pkg_test is type t_test IS RECORD( list_id number, dept varchar2, name varchar2, age number, level number, address varchar2); type tab_test is table of t_test index by binary_integer; procedure p_get_data_test(dept in varchar2, age in number, enter_date in varchar2, end_date in varchar2, report_data out tab_test); end pkg_test; 包体: create or replace package pkg_test is procedure p_get_data_test(dept in varchar2, age in number, enter_date in varchar2, end_date in varchar2, report_data out tab_test) as cursor c_get_data is select list_id, '', name, age, -1, address from t_user where 1= 1; m_t_test t_test; m_tab_test tab_test; m_dept varchar2(20); m_level number := -1; m_list_id number := 0; m_count number := 0; begin open c_get_data; fetch c_get_data into m_t_test; exit when c_get_data%notfound; loop m_list_id := m_t_test.list_id; m_dept := p_get_dept(m_list_id); m_level := p_get_level(m_list_id); m_t_test.dept := m_dept; m_t_test.level := m_level; m_tab_test(m_count) := m_t_test; m_count := m_count + 1; end loop; close c_get_data; end p_get_data_test; end pkg_test;