在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;
-- 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;
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;