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

46 阅读1分钟

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

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

  • extend[(count[, idx])]

    参数:idx和count为int4类型

    返回值:无返回值

    功能描述:仅支持nesttable类型。在nesttable变量末尾拓展1个或count个元素。存在idx下标元素时,拷贝count个idx下元素到变量末尾。

    约束:嵌套场景不支持extend()。

    示例:

    openGauss=# declare
    openGauss-#     type nest is table of int;
    openGauss-#     a nest := nest(1);
    openGauss-# begin
    openGauss$#     raise info '%', a;
    openGauss$#     a.extend;
    openGauss$#     raise info '%', a;
    openGauss$# end;
    openGauss$# /
    INFO:  {1}
    INFO:  {1,NULL}
    ANONYMOUS BLOCK EXECUTE
    
    openGauss=# declare
    openGauss-#     type nest is table of int;
    openGauss-#     a nest := nest(1);
    openGauss-# begin
    openGauss$#     raise info '%', a;
    openGauss$#     a.extend(2);
    openGauss$#     raise info '%', a;
    openGauss$# end;
    openGauss$# /
    INFO:  {1}
    INFO:  {1,NULL,NULL}
    ANONYMOUS BLOCK EXECUTE
    
    openGauss=# declare
    openGauss-#     type nest is table of int;
    openGauss-#     a nest := nest(1);
    openGauss-# begin
    openGauss$#     raise info '%', a;
    openGauss$#     a.extend(2,1);
    openGauss$#     raise info '%', a;
    openGauss$# end;
    openGauss$# /
    INFO:  {1}
    INFO:  {1,1,1}
    ANONYMOUS BLOCK EXECUTE
    

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

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