简体   繁体   English

在listagg中发布

[英]Issue in listagg

I have to concatenate 2 columns and put the value. 我必须连接2列并放入值。 but the problem is even if both the values are null it is still giving (:) as per below syntax. 但是问题是,即使两个值都为null,也仍然按照以下语法提供(:)。 is there anyway we can remove column in the output if both values are null. 无论如何,如果两个值都为null,我们可以在输出中删除列。

listagg(AP.ISSUE_ID||':'||ISS.ISSUE_DESCRIPTION ,'; ') within group(order by AP.ISSUE_ID||':'||ISS.ISSUE_DESCRIPTION) DESCRIPTION,

If you want to ignore a column in listagg() , set the value to NULL . 如果要忽略listagg()的列,请将值设置为NULL In this case, Oracle accepts NULL values for string concatenation. 在这种情况下,Oracle接受NULL值进行字符串连接。 So, let's do a test after the concatenation: 因此,让我们在串联后进行测试:

listagg(nullif(AP.ISSUE_ID ||| ':' || ISS.ISSUE_DESCRIPTION, ':'),'; ')
    within group (order by AP.ISSUE_ID || ':'|| ISS.ISSUE_DESCRIPTION) as DESCRIPTION,
AP.ISSUE_ID || nvl2(AP.ISSUE_ID || ISS.ISSUE_DESCRIPTION, ':' || ISS.ISSUE_DESCRIPTION, null)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM