PGSQL下的常用函数

1、COALESCE — 空值替换函数。
ExportDocumenttaskMapper.xml.listBusiInfos4Export                    ---coalesce(cbi.valid_month, '999999')
IntegrationPointConfigMapper.xml.getIntegrationPointConfigList         ---round(coalesce(pc.deduction_value,0) * 100,2)||'%'
2、regexp_split_to_table — 行专列
示例:regexp_split_to_table(col, 'splitor'):如果某条记录的col列的值为‘1,2,3,4,5',而splitor为',',则结果是:该条记录被转换成5条记录,且各条记录的col列的值依次为1、2、3、4、5
select * from regexp_split_to_table('kenyon,love,1,china,!',',');
CmNowManagerCommissionMapper.xml.selectAllCommission
3、regexp_split_to_array


select string_to_array('1,2,3,4,5,6',',') arr from dual;
select regexp_split_to_array('1,2,3,4,5,6',',') arr from dual;
select * from regexp_split_to_array('1,2,3,4,5,6',',');
select regexp_split_to_table('1,2,3,4,5,6',',') bb from dual;
select * from dual where '1' in (select * from regexp_split_to_table('1,2,3,4,5,6',','));

 select * from dual where '1' in (SELECT
            UNNEST (
                regexp_split_to_array('1,2,3,4,5,6',',')
            ));
 select * from dual where '1' in (SELECT
            UNNEST (
                string_to_array('1,2,3,4,5,6',',')
            ));
UNNEST--表示把array类型展开成多行
string_to_array和regexp_split_to_array效果基本一致
CommBilloneApplReview_Column_List
regexp_split_to_array(d.business_type,',')@>array[t.businessType || '']

转载于:https://www.cnblogs.com/fengyouheng/p/10266779.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值