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

43 阅读1分钟

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

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

集合类型函数

  • exists(idx)

    参数:idx为int4类型或varchar类型,

    返回值:true or false,bool类型

    功能描述:查找指定位置是否存在有效元素。

    示例:

    openGauss=# declare
    openGauss-#     type nest is table of varchar2;
    openGauss-#     a nest := nest('happy','?');
    openGauss-#     flag bool;
    openGauss-# begin
    openGauss$#     flag := a.exists(1);
    openGauss$#     raise info '%', flag;
    openGauss$#     flag := a.exists(10);
    openGauss$#     raise info '%', flag;
    openGauss$# end;
    openGauss$# /
    INFO:  t
    INFO:  f
    ANONYMOUS BLOCK EXECUTE
    
    openGauss=# declare
    openGauss-#     type nest is table of varchar2 index by varchar2;
    openGauss-#     a nest;
    openGauss-#     flag bool;
    openGauss-# begin
    openGauss$#     a('1') := 'Be';
    openGauss$#     a('2') := 'happy';
    openGauss$#     a('3') := '.';
    openGauss$#     flag := a.exists('1');
    openGauss$#     raise info '%', flag;
    openGauss$#     flag := a.exists('ddd');
    openGauss$#     raise info '%', flag;
    openGauss$# end;
    openGauss$# /
    INFO:  t
    INFO:  f
    ANONYMOUS BLOCK EXECUTE
    

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

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