日期:2014-05-17 浏览次数:21097 次
CREATE OR REPLACE TYPE test_obj AS OBJECT
(
c1 NUMBER,
c2 number
);
CREATE OR REPLACE TYPE test_type AS TABLE OF test_obj;
--创建一个函数
CREATE OR REPLACE FUNCTION testFunc
RETURN test_type PIPELINED
AS
begin
PIPE ROW(test_obj(1,2));
PIPE ROW(test_obj(3,4));
end;
--测试该函数
select * from table(testFunc());
--创建一个表
create table test_table(col_1 number);
insert into test_table(col_1) values(1);
insert into test_table(col_1) values(2);
insert into test_table(col_1) values(3);
--连接查询 ---------通过
select * from test_table a,table(testFunc())b where a.col_1<=b.c1;
----------下面这句查询报错"ORA-03113: 通信通道的文件结束",并且把test_table清空
--select * from test_table a,table(testFunc())b where a.col_1>=b.c1;