oracle table()函数用法
来源:互联网 发布:控制usb hub端口 编辑:程序博客网 时间:2024/04/30 13:04
/*
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 table (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 table(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);
/*
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 table(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 table(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);
- oracle table()函数用法
- oracle table()函数用法
- Oracle table()函数用法
- oracle table()函数用法
- oracle table()函数用法
- Oracle table()函数用法
- oracle table()函数用法
- PL/SQL表(oracle内存表)---table()函数用法
- PL/SQL表(oracle内存表)---table()函数用法
- PL/SQL表(oracle内存表)---table()函数用法
- Oracle PLsql table用法
- oracle table()函数应用;
- oracle table 函数
- oracle drop table的用法
- oracle中的temporary table用法
- oracle table()函数的使用
- Oracle函数返回Table集合
- Oracle杂文:table函数使用
- Ubuntu常用命令大全
- IOS QQ2013内测版破解方法
- 4个信号表明你是一个失败的领导
- PHP哈希表碰撞攻击原理
- 成功谈判 你需要几个锦囊?
- oracle table()函数用法
- 一个人的宽度决定了他的高度
- C++ static、const和static const 以及它们的初始化
- 善于拜访是另一种经营智慧
- 打造新老员工双赢机制变对立为统一
- Linux 设备驱动--- 内核等待队列 --- wait_queue_head --- wait_event_interruptible --- 按键驱动程序优化
- 企业如何避免用错人
- Ubuntu 环境变量及 ADB 配置
- 设计模式--行为模式--NULL Object--Java