什么是高级?这就叫高级—openGauss(121)

20 阅读1分钟

#openGauss #入门 #安装 #数据库 #开源

知识来源:docs-opengauss.osinfra.cn/zh/

集合MULTISET函数

  • MULTISET UNION [ALL | DISTINCT]

    参数:nesttable类型

    返回值:nesttable类型

    功能描述:两个集合变量的并集,ALL不去除重复元素,DISTINCT去除重复元素。

    示例:

    openGauss=# declare
    openGauss-#     type nest is table of int;
    openGauss-#     a nest := nest(1,2);
    openGauss-#     b nest := nest(2,3);
    openGauss-# begin
    openGauss$#     a := a MULTISET UNION ALL b;
    openGauss$#     raise info '%', a;
    openGauss$# end;
    openGauss$# /
    INFO:  {1,2,2,3}
    ANONYMOUS BLOCK EXECUTE
    
    openGauss=# declare
    openGauss-#     type nest is table of int;
    openGauss-#     a nest := nest(1,2);
    openGauss-#     b nest := nest(2,3);
    openGauss-# begin
    openGauss$#     a := a MULTISET UNION DISTINCT b;
    openGauss$#     raise info '%', a;
    openGauss$# end;
    openGauss$# /
    INFO:  {1,2,3}
    ANONYMOUS BLOCK EXECUTE
    

#openGauss #入门 #安装 #数据库 #开源

知识来源:docs-opengauss.osinfra.cn/zh/