替换db2中的函数

时间:2013-09-05 20:12:01

标签: sql replace db2

我在使用简单的替换功能时遇到了一些问题。我需要用|替换a对于point_of_contact列,但我不确定为什么我收到-104错误。我已经研究了我认为正确的语法并尝试了一个case语句并替换了函数,但它对我不起作用。我正在使用DB2,感谢您的帮助。

SELECT RowNumber() over (PARTITION BY F13.DIM_PROJECT_ID ORDER BY F13.PROJECT_NAME), 

        F13.DIM_PROJECT_ID,
        F2P.NAME_LAST,
        F2P.NAME_FIRST,
        --F2P.POINT_OF_CONTACT, 
        --CASE WHEN F2P.POINT_OF_CONTACT like '%,%' THEN Replace(F2P.POINT_OF_CONTACT,',','|') ELSE F2P.POINT_OF_CONTACT,
        REPLACE(F2P.POINT_OF_CONTACT, ',', '|') AS F2P.POINT_OF_CONTACT,
        F13.PROJECT_NAME,
        F13.TITLE,
        F2H.CREATION_DATE,
        F13.FIELD A,
        F2H.AMOUNT,
        F2H.BUILDING_NAME,
        F2H.PERCENTAGE,
        F2H.ABILITY,
        F2SB.HOURS16,
        F2SB.HOURS33,
        F2SB.HOURS100  
FROM FACT_TABLE AS F13
INNER JOIN PERSONNEL AS F2P ON F13.DIM_PROJECT_ID = F2P.DIM_PROJECT_ID
LEFT JOIN JOB AS F2SB ON F13.DIM_PROJECT_ID = F2SB.DIM_PROJECT_ID
LEFT JOIN HOURS AS F2H ON F13.DIM_PROJECT_ID = F2H.DIM_PROJECT_ID

1 个答案:

答案 0 :(得分:8)

在列别名上,删除表别名F2P.

REPLACE(F2P.POINT_OF_CONTACT, ',', '|') AS POINT_OF_CONTACT,