create or replace type type_row as object
(
id int,
name varchar(50)
)
create or replace type type_table is table of type_row;------------创建简单的函数
返回tble
create or replace function f_tests(s number)
return type_table pipelined
as
v_type_row type_row;--行
begin
for i in 1..s loop
v_type_row:= type_row(i,to_char(i*i));
pipe row(v_type_row);
end loop;
return;
end f_tests;

本文介绍了使用PL/SQL创建自定义类型和函数的方法。通过定义复合类型type_row及表类型type_table,实现了一个返回多行记录的管道函数f_tests。此函数接收一个数值参数并返回一系列带有id和name属性的记录。
&spm=1001.2101.3001.5002&articleId=38020211&d=1&t=3&u=70abc7378ad74fa183fa5fdf8295dd5a)
635

被折叠的 条评论
为什么被折叠?



