#openGauss #入门 #安装 #数据库 #开源
知识来源:docs-opengauss.osinfra.cn/zh/
-
unnest_table(anyindexbytable)
描述:返回table of index by类型根据index排序后的元素集合。
返回类型:setof anyelement
约束:不支持tableof类型嵌套tableof类型或者tableof嵌套其他类型再嵌套tableof类型的情况。只支持index by int类型,不支持index by varchar类型。
示例:
create or replace procedure f1() as type t1 is table of int index by int; v2 t1 := t1(1=>1, -10=>(-10), 6=>6, 4=>null); tmp int; cursor c1 is select * from unnest_table(v2); begin open c1; for i in 1 .. v2.count loop fetch c1 into tmp; if tmp is null then dbe_output.print_line(i || ': is null'); else dbe_output.print_line(i || ': ' || tmp); end if; end loop; close c1; end; / openGauss=# call f1(); 1: -10 2: 1 3: is null 4: 6 f1 ---- (1 row)
#openGauss #入门 #安装 #数据库 #开源