在Oracle中编写返回数据集的包

create or replace package tgatePack is

  
-- Author  : GSL
  
-- Created : 2007-06-01 10:30:24
  
-- Purpose : 
  
  
-- Public type declarations
  type rDataSet 
is ref cursor;

  
-- Public function and procedure declarations
  procedure GetAlarmVehicle(p_id alarm_data.id
%type, ResultCursor out rDataSet);
end tgatePack;

定义包头后,再定义包体,将数据以游标返回

create or replace package body tgatePack is
procedure GetAlarmVehicle(
       p_id alarm_data.id
%type,
       ResultCursor 
out rDataSet
       ) 
is
begin

        open ResultCursor 
for
              select 
* from tablename where id=p_id;
end;

end tgatePack;

posted on 2007-06-01 10:51  龙少爷  阅读(436)  评论(1编辑  收藏  举报

导航