oracle pl/sql 函数中链表的使用
2010-05-25 23:05
357 查看
定义:
type t_numberstab is table of number;
举例:
create or replace function getbldroomidforcert(p_certid number,p_sequence number) return varchar2
is
type t_numberstab is table of number;
v_bldroomids t_numberstab:=t_numberstab();
v_cnt number:=1;
begin
for brrs in (select bldroomid,(select buildno from building where buildid=bldroom.buildid) buildno,getbrfloors(bldroomid) flooron,getbldroompart(bldroomid) part from bldroom where bldroomid in (select bldroomid from rightcertroom where certid=p_certid and exists (select 1 from rightcert where certid=p_certid and activeid=createactiveid)) order by buildno,flooron,part)
loop
v_bldroomids.extend;
v_bldroomids(v_cnt):=brrs.bldroomid;
v_cnt:=v_cnt+1;
end loop;
if v_bldroomids.exists(p_sequence) then
return v_bldroomids(p_sequence);
else
return -1;
end if;
end getbldroomidforcert;
/
show err;
type t_numberstab is table of number;
举例:
create or replace function getbldroomidforcert(p_certid number,p_sequence number) return varchar2
is
type t_numberstab is table of number;
v_bldroomids t_numberstab:=t_numberstab();
v_cnt number:=1;
begin
for brrs in (select bldroomid,(select buildno from building where buildid=bldroom.buildid) buildno,getbrfloors(bldroomid) flooron,getbldroompart(bldroomid) part from bldroom where bldroomid in (select bldroomid from rightcertroom where certid=p_certid and exists (select 1 from rightcert where certid=p_certid and activeid=createactiveid)) order by buildno,flooron,part)
loop
v_bldroomids.extend;
v_bldroomids(v_cnt):=brrs.bldroomid;
v_cnt:=v_cnt+1;
end loop;
if v_bldroomids.exists(p_sequence) then
return v_bldroomids(p_sequence);
else
return -1;
end if;
end getbldroomidforcert;
/
show err;
相关文章推荐
- Oracle PL/SQL之函数索引(Function-based indexes)使用示例
- 使用wrap和unwrap加密解密Oracle的PL/SQL对象(包,存储过程,函数等)代码
- Oracle PL/SQL之函数索引(Function-based indexes)使用示例
- ORACLE数库之PL/SQL高级篇 存储过程,函数,包,触发器的使用
- oracle pl/sql 函数中使用数组
- Oracle PL/SQL之函数索引(Function-based indexes)使用示例
- 使用wrap和unwrap加密解密Oracle的PL/SQL对象(包,存储过程,函数等)代码
- Oracle使用技巧及PL/SQL Developer配置
- 不安装Oracle客户端使用PL/SQL远程连接数据库
- Oracle中使用PL/SQL得到服务器和客户端的IP
- ORACLE PL/SQL编程之六:把过程与函数说透(穷追猛打,把根儿都拔起!)
- 源码-Oracle数据库管理-第十四章-记录与集合-Part 1(使用PL/SQL记录)
- oracle中pl/sql编程---存储过程,函数,触发器,包
- Oracle instant client及pl sql developer的使用
- Oracle使用PL/SQL操作COM对象
- oracle 时间使用集合(PL/SQL)
- Oracle笔记 九、PL/SQL 游标的使用
- 在SQL中使用PL/SQL函数存在的问题
- 使用instantclient_11_2 和PL/SQL Developer工具包连接oracle 11g远程数据库
- 如何在不安装Oracle客户端的情况下,使用PL/SQL Developer连接数据库