本帖最后由 caesa_he 于 2009-08-05 12:43:11 编辑

解决方案 »

  1.   

    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往里面插数据。
      

  2.   

    谢谢shiyiwan,我想知道,如果按照上述代码如何修改成ORACLE的,语法上做如何修改.感谢!
      

  3.   

    看看这两个文章,是有关tsql和plsql差异的http://www.inthirties.com/?p=790http://www.inthirties.com/?p=788