#openGauss #入门 #安装 #数据库 #开源
知识来源:docs-opengauss.osinfra.cn/zh/
-
delete[(idx1[, idx2])]
参数:idx1和idx2为int4类型或varchar2类型
返回值:无返回值
功能描述:无参数时,(nesttable)删除集合类型的所有元素和空间,后续使用需要重新extend,(indexbytable)删除所有元素内容,一个参数删除指定位置元素(不删除空间),两个参数删除小标区间内的元素(不删除空间)。
约束:嵌套场景不支持delete()。
示例:
openGauss=# declare openGauss-# type nest is table of int; openGauss-# a nest := nest(1,2,3,4,5); openGauss-# begin openGauss$# raise info '%', a; openGauss$# a.delete; openGauss$# raise info '%', a; openGauss$# end; openGauss$# / INFO: {1,2,3,4,5} INFO: {} ANONYMOUS BLOCK EXECUTE openGauss=# declare openGauss-# type nest is table of int; openGauss-# a nest := nest(1,2,3,4,5); openGauss-# begin openGauss$# raise info '%', a; openGauss$# a.delete(3); openGauss$# raise info '%', a; openGauss$# end; openGauss$# / INFO: {1,2,3,4,5} INFO: {1,2,4,5} ANONYMOUS BLOCK EXECUTE openGauss=# declare openGauss-# type nest is table of int; openGauss-# a nest := nest(1,2,3,4,5); openGauss-# begin openGauss$# raise info '%', a; openGauss$# a.delete(2,4); openGauss$# raise info '%', a; openGauss$# end; openGauss$# / INFO: {1,2,3,4,5} INFO: {1,5} ANONYMOUS BLOCK EXECUTE
#openGauss #入门 #安装 #数据库 #开源