时间:2021-07-01 10:21:17 帮助过:13人阅读
decode(条件,值1,返回值1,值2,返回值2,...值n,返回值n,缺省值)
某些场景可以代替case when
首先看下数据情况
想把这个人的阶段列转成一行分隔显示使用listagg函数
select
listagg (decode(sts,‘A‘,coll_stage),‘,‘) within group (order by coll_stage desc) coll_stage_a, listagg (decode(sts,‘I‘,coll_stage),‘,‘) within group (order by coll_stage desc) coll_stage_i, listagg (coll_stage,‘,‘) within group (order by coll_stage desc) coll_stage_all from lc_contcoll_rel where cont_no = ‘HT90201804121600006690493‘ group by cont_no
结果:
oracle 列转行函数listagg、判断函数decode
标签:rom 图片 oracle decode class desc src value HERE