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 和 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怎么办呢?
先谢了!
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;
/