zoukankan      html  css  js  c++  java
  • 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 || '']

  • 相关阅读:
    页面笔记
    RestTemplate
    Spring中使用HibernateCallback
    工作中的小零碎
    hibernate核心思想 体系结构(转)
    db2备份和导入单个表操作
    MSB-STRUTS-课堂笔记
    设计模式:策略模式(转)
    java中的匿名内部类总结(转)
    struts2.0中Action的对象生命周期详解!!(转)
  • 原文地址:https://www.cnblogs.com/fengyouheng/p/10266779.html
Copyright © 2011-2022 走看看