存储过程如何返回一个结果集

请问哪位知道在ORACLE中
存储过程如何返回一个结果集
[40 byte] By [glmcglmc-joe] at [2007-12-16]
# 1
干吗返回结果集
你用游标进行操作不是挺好的
sgq_hit-老槐树 at 2007-10-23 > top of Msdn China Tech,Oracle,基础和管理...
# 2
create or replace package test
as
type refcursor is ref cursor;
end;

create or replace procedure testcursor(p_rst out test.refcursor)
as
begin
open p_rst for
select * from table;
end;
yzf01 at 2007-10-23 > top of Msdn China Tech,Oracle,基础和管理...
# 3
谢谢yzf01 和 sgq_hit,但是。。。
我在SqlServer中有个过程如:
CREATE PROCEDURE proc_tmp(@unit int,@bianhao char(4))
AS

select rectime,badai*100 as badai
from tsum_his_alarm
where bianhao=@bianhao and bianhao=@bianhao
这样我可以在C++Builder 中直接调用这个存储过程,
但ORACLE怎么办呢?
先谢了!
glmcglmc-joe at 2007-10-23 > top of Msdn China Tech,Oracle,基础和管理...
# 4
search
jlandzpa-jlandzpa at 2007-10-23 > top of Msdn China Tech,Oracle,基础和管理...
# 5
ORACLE和SQL在存储过程中实现是不一样的,
如果象你所说,是不能实现的。
jaguarcts-xzh2000 at 2007-10-23 > top of Msdn China Tech,Oracle,基础和管理...
# 6
SQL Server和Oracle是有区别的。在oracle中返回数据集可以这样写:
CREATE OR REPLACE PACKAGE CX_InfoPhonePack
AS
TYPE curPhoneCode IS REF CURSOR RETURN YW_Info%ROWTYPE;
END;
/
CREATE OR REPLACE PROCEDURE CX_InfoPhoneProc
(iPhoneCode YW_Info.PHONECODE%type,cPhoneCode OUT CX_InfoPhonePack.curPhoneCode)
AS
BEGIN
OPEN cPhoneCode FOR
SELECT *
FROM YW_Info
WHERE (PicID>0) and (PhoneCode Like '%'||iPhoneCode||'%');
END;
/
erbird-饿鸟人 at 2007-10-23 > top of Msdn China Tech,Oracle,基础和管理...