欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Oracle的一些函数(待补充)

程序员文章站 2024-03-14 11:14:58
...

关于decode,wm_concat,instr,substr函数的使用

SQL语句

SELECT
    b.CHANNEL_ID,
    b. OPERATOR,
    b.ORGANIZATION_ID,
    b.BIZ_TYPE_CODE,
    b.SCENE_CERT_SN,

   wm_concat(b.PROOF_PDF_ID)  "合并",
   instr(wm_concat(b.PROOF_PDF_ID), ',')-1  "下标",
   substr(wm_concat(b.PROOF_PDF_ID),0,instr(wm_concat(b.PROOF_PDF_ID), ',')-1)  "截取0-下标",

   DECODE(instr(wm_concat(b.PROOF_PDF_ID), ',')-1,-1,wm_concat(b.PROOF_PDF_ID),substr(wm_concat(b.PROOF_PDF_ID),0,instr(wm_concat(b.PROOF_PDF_ID), ',')-1) ) 判断

FROM
    SEAL_LOG b
WHERE
    SCENE_CERT_SN IS NOT NULL
GROUP BY
    b.CHANNEL_ID,
    b. OPERATOR,
    b.ORGANIZATION_ID,
    b.BIZ_TYPE_CODE,
    b.SCENE_CERT_SN

效果

Oracle的一些函数(待补充)

相关标签: oracle