看书上写,游标变量不能在包定义,在9i试了试,结果是可以得,
create   or   replace   package   Test2Package   as   
    
          type   mycursor   is   ref   cursor;   --   定义游标变量   
    
            procedure   GetRecords(ret_cursor   out   mycursor);   --   定义过程,用游标变量作为返回参数   
    
  end   Test2Package;   create   or   replace   package   body   Test2Package   as       
  /*过程体*/   
    
                      procedure   GetRecords(ret_cursor   out   mycursor)   as   
    
                      begin   
    
                              open   ret_cursor   for   select   *   from   wwcm.cm_lookups;   
    
                      end   GetRecords;   
    
  end   Test2Package;   
编译通过,没有错误;

解决方案 »

  1.   

    在ORACLE 里面是可以直接在包里面定義的啊!
      

  2.   

    在包中,  游标变量不可以被定义,但是可以在包里面的procedure中,把游标类型作为参数;
      在包头中,先定义一个游标类型即可
      

  3.   

    create   or  replace  package   Test2Package   as       
     type   mycursor is ref   cursor;   -- 定义游标变量 ----这里是定义游标类型不是定义游标变量
     c1 mycursor  -------这里才是定义游标变量,包将会出错