create or replace package mypackage is type t_cursor is ref cursor;
procedure dbo.F_Tree(v_code in varchar2(50), v_cursor out t_cursor);
procedure dbo.Pro_Tree(v_code in varchar2(50), v_cursor out t_cursor);end mypackage;create or replace package body mypackage is procedure dbo.F_Tree(v_code in varchar2(50), v_cursor out t_cursor) is v_i number := 0; v_c t_cursor := null; begin v_i := 1; open v_c for select a.*, v_i from srt_mxlmxb a where a.parentcode = v_code; loop -- exit when v_c%notfound; end loop; end dbo.F_Tree;end mypackage; oracle中返回结果集可以用cursor,但是尝试着写了下发现每个loop里面都需要插入一条数据,这样还不如建一个临时表然后通过procedure往里面插数据。
is
type t_cursor is ref cursor;
procedure dbo.F_Tree(v_code in varchar2(50), v_cursor out t_cursor);
procedure dbo.Pro_Tree(v_code in varchar2(50), v_cursor out t_cursor);end mypackage;create or replace package body mypackage
is
procedure dbo.F_Tree(v_code in varchar2(50), v_cursor out t_cursor)
is
v_i number := 0;
v_c t_cursor := null;
begin
v_i := 1;
open v_c for select a.*, v_i from srt_mxlmxb a where a.parentcode = v_code;
loop
--
exit when v_c%notfound;
end loop;
end dbo.F_Tree;end mypackage;
oracle中返回结果集可以用cursor,但是尝试着写了下发现每个loop里面都需要插入一条数据,这样还不如建一个临时表然后通过procedure往里面插数据。