PL/SQL集合增强
添加时间: 2008-4-19 21:49:00 作者: Oracle指导 阅读次数:13 来源: http://www.d9soft.com
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;
上下文章:
上一篇文章: 在Windows下管理Oracle9i 服务 下一篇文章: Oracle入门基本知识
相关软件:

