首页 > 代码库 > ORACLE 多列合并成一行数据 WM_CONCAT函数以及REPLACE

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

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