PL/SQL表---table()函数用法:
来源:互联网 发布:中国农大网络教育平台 编辑:程序博客网 时间:2024/06/06 03:28
利用table()函数,我们可以将PL/SQL返回的结果集代替table。
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));
/*
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));
/*
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);
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));
/*
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));
/*
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()函数用法
- 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表(oracle内存表)---table()函数用法
- PL/SQL表(oracle内存表)---table()函数用法
- PL/SQL表(oracle内存表)---table()函数用法
- PL/SQL 表函数, Cursor Variable, pipelined table function
- PL/SQL table
- PL/SQL TABLE 表达式
- pl/sql中使用table()函数的例子
- PL/SQL中Lpad函数和Rpad函数的用法
- 5分钟快速了解JSON,实例项目动手做
- android学习之widget
- tomcat 内存溢出
- ecmall 写的一个model 下的方法
- 收集的一些新词,之前自己没有看过的。
- PL/SQL表---table()函数用法:
- 同步原语
- 红黑树的C++实现与解析
- 将tomcat控制台的日志打到你想要的文件中
- poj_1671 Phone List
- linux中文件的压缩与打包简介
- mysql 全国省(市)/县地区数据
- 图标等资源的引用
- 检测到 LoaderLock Message Microsoft.DirectX.dll”正试图在 OS 加载程序锁内执行托管代码。