GreenPlum常用字符串函数如下:
测试代码:
eda_gp=> select 'green'||'plum' as dbname;
dbname
-----------
greenplum
(1 row)
eda_gp=> select length('greenplum');
length
--------
9
(1 row)
eda_gp=> select position('plum' in 'greenplum');
position
----------
6
(1 row)
eda_gp=> select substring('greenplum' from 6 for 3);
substring
-----------
plu
(1 row)
eda_gp=> select trim(both 'x' from 'xgreenplumxx');
btrim
-----------
greenplum
(1 row)
eda_gp=> select upper('greenplum');
upper
-----------
GREENPLUM
(1 row)
eda_gp=> select lower('GREENPLUM');
lower
-----------
greenplum
(1 row)
eda_gp=> select overlay('greenxxxm' placing 'plu' from 6 for 3);
overlay
-----------
greenplum
(1 row)
eda_gp=> select replace('greenplum','plum','xxx');
replace
----------
greenxxx
(1 row)
eda_gp=> select split_part('abc|def|ght','|',3);
split_part
------------
ght
(1 row)