先定义包
create or replace package p_temp
as
  TYPE mycursor is ref cursor;  procedure get(t_id number,result out mycursor);
end p_temp;
定义包体
create or replace package body p_temp
as
  procedure  get (t_id number,result out mycursor)
  is
     v_sql   varchar2(200);
  begin
     if p_id = 0 then
        open result for
           SELECT tid,str1, str2, str3, str14 from test;
     else
        v_sql :=
           'select tid,str1, str2, str3, str14 from  where tid=:t_id';
        open result  for v_sql using p_id;
     end if; 
  end get;
end p_temp;未测试