内容或简介: -- NET7B.COM(STORM)关于数据库的游标(cursor)大家肯定都接触不少,我们可以通过OPEN,FETCH,CLOSE操作控制游标进 行各种方便的操作,这方面的例子我就不在重复了。我们现在要介绍的是游标变量(cursor variable)。 类似游标,游标变量也是指向一个查询结果集的当前行。不同的是,游标变量能为任何类型相似 (type-compatible)的查询打开,而并不是绑定到某一个特定的查询。通过游标变量,你可以在数据 库的数据提取中获得更多的方便。file://============================================= // 定义包、及存储过程 // 请注意游标变量的声明和使用的方法 // 这里的游标是输出(out)参数 //============================================= create or replace package audit is -- Public type declarations, cursor variable type outList is ref cursor; PROCEDURE sp_audit_GetTaxpayerList(organize in varchar2, taxpayerList out outList);
end audit;create or replace package body audit is -- taxpayerList is cursor variable PROCEDURE sp_audit_GetTaxpayerList(organize in varchar2, taxpayerList out outList) is begin OPEN taxpayerList FOR select strName , strTelephone from "TB_PERSONINFO" a WHERE a.organize = organize ;
如:sqlpuls worksheet
-- NET7B.COM(STORM)关于数据库的游标(cursor)大家肯定都接触不少,我们可以通过OPEN,FETCH,CLOSE操作控制游标进
行各种方便的操作,这方面的例子我就不在重复了。我们现在要介绍的是游标变量(cursor variable)。
类似游标,游标变量也是指向一个查询结果集的当前行。不同的是,游标变量能为任何类型相似
(type-compatible)的查询打开,而并不是绑定到某一个特定的查询。通过游标变量,你可以在数据
库的数据提取中获得更多的方便。file://=============================================
// 定义包、及存储过程
// 请注意游标变量的声明和使用的方法
// 这里的游标是输出(out)参数
//=============================================
create or replace package audit is -- Public type declarations, cursor variable
type outList is ref cursor; PROCEDURE sp_audit_GetTaxpayerList(organize in varchar2, taxpayerList out outList);
end audit;create or replace package body audit is
-- taxpayerList is cursor variable
PROCEDURE sp_audit_GetTaxpayerList(organize in varchar2, taxpayerList out outList)
is
begin
OPEN taxpayerList
FOR
select
strName , strTelephone
from "TB_PERSONINFO" a
WHERE a.organize = organize ;
end;end audit;
www.quest.com
pl/sql developer http://www.allroundautomations.com/plsqldev.html
很好的工具