扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:Builder.com 2007年6月20日
关键字: ORACLE
Oracle Release 2 非常有力地增强了PL/SQL 集合功能,它可以对以前的发布版本进行代码维护。例如,可以在Release 2 中将PL/SQL 集合用作一个单一的参数,从而避免了使用一长串单个的字段作为参数。
另外一个优点是记录的集合现在可以是BULK COLLECTION INTO 子句的目标。而在Release 2 以前,我们必须为返回的每个列创建一个集合。例如:
Declare
type deptno_coll is table of dept.deptno%type;
type dname_coll is table of dept.dname%type;
type loc_coll is table of dept.loc%type;
deptno_list deptno_coll;
dname_list dname_coll;
loc_list loc_coll;
begin
select * bulk collect into deptno_list,dname_list,loc_list from dept;
end;
在Release 2中变成了:
Declare
type dept_coll is table of dept%rowtype;
dept_list dept_coll;
begin
select * bulk collect into dept_list from dept;
end;
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。