【发布时间】:2019-07-08 13:21:52
【问题描述】:
我想创建一个函数,它将多行返回到一个对象类型的表中。
我已经创建了一个对象和一个嵌套表对象,现在当我运行该函数时出现一个错误,提示
PL/SQL:忽略 SQL 语句 PL/SQL: ORA-00947: 没有足够的值
-- Object type creation
create or replace type test_object_sn as object
(
column_1 varchar2(30),
column_2 varchar2(30),
column_3 number
);
-- Table of object
create or replace type test_otable_sn as table of test_object_sn;
-- function (where I get an error)
create or replace function load_test_object_sn
return test_otable_sn
as
details test_otable_sn;
begin
with ad as (select 'a', 'b', 4 from dual
union all
select 'r', '5', 3 from dual
union all
select 'g', 's', 3 from dual)
select * into details from ad;
return details;
end;
我想让 test_otable_sn 表对象加载数据,然后通过我的 load_test_object_sn 函数使用 table() 函数查询它
例如select * from table(load_test_object_sn);
【问题讨论】:
标签: sql oracle plsql set-returning-functions