ORACLE 多列合并成一行数据 WM_CONCAT函数以及REPLACE

SELECT ( --SELECT  REPLACE(SBPT.PARKSTIME||‘~‘||SBPT.PARKETIME,‘,‘) REPLACE也可以
  SELECT   WM_CONCAT(SBPT.PARKSTIME||~||SBPT.PARKETIME)
  SAREE FROM 
  SYS_BERTHANDTYPE SBT LEFT JOIN 
   SYS_BERTHTYPEPARKTIME SBPT 
   ON SBT.BERTHTYPEID = SBPT.BERTHTYPEID WHERE BERTHCODE=114163 AND 
    SBPT.DATETYPE = 1 AND  SBPT.ISALLOW = 2)
    NOTALLOWTIMESPAN, 
 WM_CONCAT(SUBSTR(TO_CHAR(FREESTARTTIME,YYYY-MM-DD HH24:MI:SS),11,9)||~||SUBSTR(TO_CHAR(FREEENDTIME,YYYY-MM-DD HH24:MI:SS),11,9)) 
   FREETIMESPAN  FROM TRA_PRICINGBERTH  TPB
   LEFT JOIN TRA_PRICINGFREE TPF 
  ON TPB.PRICINGSTRATEGYID = TPF.PRICINGSTRATEGYID 
 WHERE BERTHCODE=114163 AND FREEDATETYPE=1 GROUP BY BERTHCODE

 

WM_CONCAT 合并成一行数据列 数据量大会超出字符长度

SELECT wm_concat(sbpt.ParkStime||~||sbpt.ParkEtime) FROM SYS_BerthTypeParkTime sbpt

REPLACE 分成多列
SELECT  REPLACE(sbpt.ParkStime||~||sbpt.ParkEtime,,)
 FROM SYS_BerthTypeParkTime sbpt

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。