oracle 集合操作
来源:互联网 发布:unity3d 联机 编辑:程序博客网 时间:2024/05/19 08:25
/*
oracle 集合操作函数
1.DELETE
Procedure
Deletes elements from collection.
2.TRIM
Procedure
Deletes elements from end of varray or nested table.
3.EXTEND
Procedure
Adds elements to end of varray or nested table.
4.EXISTS
Function
Returns TRUE if and only if specified element of varray or nested table exists.
5.FIRST
Function
Returns first index in collection.
6.LAST
Function
Returns last index in collection.
7.COUNT
Function
Returns number of elements in collection.
8.LIMIT
Function
Returns maximum number of elements that collection can have.
9.PRIOR
Function
Returns index that precedes specified index.
10.NEXT
Function
Returns index that succeeds specified index.
*/
declare
type s is table of pls_integer index by pls_integer;
type citypo is table of pls_integer index by varchar2(200);
citys citypo;
m pls_integer:=10;
geti pls_integer;
getj varchar2(200);
ss s;
function dealM(m pls_integer) return s is
rs s;
begin
for i in 1..m loop
rs(i):=i*10;
end loop;
return rs;
end;
begin
ss:=dealM(m);
--用for循环处理
/*
for i in 1..10 loop
dbms_output.put_line(ss(i));
end loop;
*/
--用while循环处理index为数值
/*
geti:=ss.first;
while geti is not null loop
dbms_output.put_line(ss(geti));
geti:=ss.next(geti);
end loop;
*/
--用while循环处理index为字符串的
/*
citys('shenzhen'):=100;
citys('guangzhou'):=200;
citys('shanghai'):=1000;
citys('beijing'):=2000;
getj:=citys.first;
while getj is not null loop
dbms_output.put_line(citys(getj));
getj:=citys.next(getj);
end loop;
*/
end;
oracle 集合操作函数
1.DELETE
Procedure
Deletes elements from collection.
2.TRIM
Procedure
Deletes elements from end of varray or nested table.
3.EXTEND
Procedure
Adds elements to end of varray or nested table.
4.EXISTS
Function
Returns TRUE if and only if specified element of varray or nested table exists.
5.FIRST
Function
Returns first index in collection.
6.LAST
Function
Returns last index in collection.
7.COUNT
Function
Returns number of elements in collection.
8.LIMIT
Function
Returns maximum number of elements that collection can have.
9.PRIOR
Function
Returns index that precedes specified index.
10.NEXT
Function
Returns index that succeeds specified index.
*/
declare
type s is table of pls_integer index by pls_integer;
type citypo is table of pls_integer index by varchar2(200);
citys citypo;
m pls_integer:=10;
geti pls_integer;
getj varchar2(200);
ss s;
function dealM(m pls_integer) return s is
rs s;
begin
for i in 1..m loop
rs(i):=i*10;
end loop;
return rs;
end;
begin
ss:=dealM(m);
--用for循环处理
/*
for i in 1..10 loop
dbms_output.put_line(ss(i));
end loop;
*/
--用while循环处理index为数值
/*
geti:=ss.first;
while geti is not null loop
dbms_output.put_line(ss(geti));
geti:=ss.next(geti);
end loop;
*/
--用while循环处理index为字符串的
/*
citys('shenzhen'):=100;
citys('guangzhou'):=200;
citys('shanghai'):=1000;
citys('beijing'):=2000;
getj:=citys.first;
while getj is not null loop
dbms_output.put_line(citys(getj));
getj:=citys.next(getj);
end loop;
*/
end;
- Oracle的集合操作
- Oracle的集合操作
- oracle集合的操作
- oracle 集合操作
- Oracle集合操作函数
- Oracle之集合操作
- Oracle 集合操作
- oracle 集合操作
- oracle 集合操作
- oracle集合操作符
- Oracle 集合操作符
- Oracle集合操作
- Oracle集合操作
- Oracle集合操作
- ORACLE 集合操作
- Oracle集合操作符
- Oracle 数据查询集合操作
- sql ORACLE(六): 集合操作
- oracle for 循环中倒序 用reverse
- 最大间隙问题
- android 圆角输入框的设计和使用
- oracle 几种游标循环的区别
- C++ 模板的特化与偏特化
- oracle 集合操作
- 如何在OpenWRT环境下做开发
- oracle 存储过程的学习
- javascript ready和load事件的区别
- int string 转换
- Android cacerts.bks 证书异常解决
- 编码的变体
- ImageView
- linux 下安装eclipse