PL/SQL表(oracle内存表)---table()函数用法
来源:互联网 发布:淘宝上的碳纤维方向盘 编辑:程序博客网 时间:2024/06/05 18:16
发表于:2006.08.18 10:03
分类: oracle开发
出处:http://zhouwf0726.itpub.net/post/9689/195237
---------------------------------------------------------------
/*
PL/SQL表---table()函数用法:
利用table()函数,我们可以将PL/SQL返回的结果集代替table。
oracle内存表在查询和报表的时候用的比较多,它的速度相对物理表要快几十倍。
simple example:
1、table()结合数组:
*/
create or replace type t_test as object(
id integer,
rq date,
mc varchar2(60)
);
create or replace type t_test_table as table of t_test;
create or replace function f_test_array(n in number default null) return t_test_table
as
v_test t_test_table := t_test_table();
begin
for i in 1 .. nvl(n,100) loop
v_test.extend();
v_test(v_test.count) := t_test(i,sysdate,'mc'||i);
end loop;
return v_test;
end f_test_array;
/
select * from table(f_test_array(10));
select * from the(select f_test_array(10) from dual);
/*
2、table()结合PIPELINED函数:
*/
create or replace function f_test_pipe(n in number default null) return t_test_table PIPELINED
as
v_test t_test_table := t_test_table();
begin
for i in 1 .. nvl(n,100) loop
pipe row(t_test(i,sysdate,'mc'||i));
end loop;
return;
end f_test_pipe;
/
select * from table(f_test_pipe(20));
select * from the(select f_test_pipe(20) from dual);
/*
3、table()结合系统包:
*/
create table test (id varchar2(20));
insert into test values('1');
commit;
explain plan for select * from test;
select * from table(dbms_xplan.display);
博主注:内存表的特性从9i开始提供。
- PL/SQL表(oracle内存表)---table()函数用法
- PL/SQL表(oracle内存表)---table()函数用法
- PL/SQL表(oracle内存表)---table()函数用法
- PL/SQL表---table()函数用法
- PL/SQL表---table()函数用法
- PL/SQL表---table()函数用法
- PL/SQL表--table()函数用法
- PL/SQL表---table()函数用法
- PL/SQL表---table()函数用法
- PL/SQL表---table()函数用法
- PL/SQL表---table()函数用法:
- PL/SQL表---table()函数用法
- PL/SQL表---table()函数用法
- Oracle PL/SQL之嵌套表(Nested Table)
- PL/SQL 表函数, Cursor Variable, pipelined table function
- oracle pl/sql Nested Table
- oracle pl/sql 函数
- oracle pl/sql 函数
- VendorCache 类
- Window 消息大全
- learning jsp for the 2nd time
- 马的棋盘遍历的一个近似算法
- 数通产品线C语言编程基础题库
- PL/SQL表(oracle内存表)---table()函数用法
- 字节对齐和C/C++函数调用方式学习总结
- bat命令大全
- 外连接与union
- 在Windows下用colinux来boot硬盘上的linux系统!
- 带爆炸效果的扫雷(源码5)
- 大师,终见大师——中国"人工智能"泰斗涂序彦
- How Time Flies!
- 使用正规表达式编写更好的 SQL