SQL Command Error

Hi,

I have this SQL code below, and it is giving me an error. I am not sure where I am missing quotes. Would be great if you guys can help!

“Select ““PS_MKF_GL_SUM_MV””.”“J_CAL_MONTH_ID”" ““GL_Month””, ““PS_MKF_GL_SUM_MV””."“J_DOC_TYPE”" ““DocType””, Case When ““PS_JWD_ACCOUNT””."“J_LOD7_OBJAC_SRCCD”" <> ’ ’ then Case When ““PS_JWD_ACCOUNT””."“J_LOD7_SUB_SRCCD”" <> ‘-’ then ““PS_JWD_ACCOUNT””."“J_LOD7_OBJAC_SRCCD”" || ‘.’ || ““PS_JWD_ACCOUNT””."“J_LOD7_SUB_SRCCD”" Else ““PS_JWD_ACCOUNT””."“J_LOD7_OBJAC_SRCCD”" End Else ““PS_JWD_ACCOUNT””."“J_LOD6_OBJAC_SRCCD”" End ““Account””, ““PS_JWD_ACCOUNT””."“J_ACCOUNT_DESC”" ““AccountDesc””, sum("“PS_MKF_GL_SUM_MV”"."“AMOUNT”") ““Amount”” From ““PSOFTDW””."“PS_MKF_GL_SUM_MV”" ““PS_MKF_GL_SUM_MV””, ““PSOFTDW””."“PS_JWD_ACCOUNT”" ““PS_JWD_ACCOUNT””, ““PSOFTDW””."“PS_JWD_BUS_UNIT”" ““C__GLSUM__PS_JWD_BUS_UNIT”” Where ““PS_MKF_GL_SUM_MV””."“J_BUSINESS_UNIT_ID”" = ““C__GLSUM__PS_JWD_BUS_UNIT””."“J_BUSINESS_UNIT_ID”" And ““C__GLSUM__PS_JWD_BUS_UNIT””."“J_COMPANY_ID”" = 2 And ““PS_JWD_ACCOUNT””."“J_ACCOUNT_ID”" = ““PS_MKF_GL_SUM_MV””."“J_ACCOUNT_ID”" And ““PS_MKF_GL_SUM_MV””."“J_CAL_MONTH_ID”" = TO_CHAR (ADD_MONTHS (SYSDATE, -1), ‘YYYYMM’) And ““PS_MKF_GL_SUM_MV””."“J_DOC_TYPE”" In (‘RI’) Group By ““PS_MKF_GL_SUM_MV””."“J_CAL_MONTH_ID”", Case When ““PS_JWD_ACCOUNT””."“J_LOD7_OBJAC_SRCCD”" <> ’ ’ then Case When ““PS_JWD_ACCOUNT””."“J_LOD7_SUB_SRCCD”" <> ‘-’ then ““PS_JWD_ACCOUNT””."“J_LOD7_OBJAC_SRCCD”" || ‘.’ || ““PS_JWD_ACCOUNT””."“J_LOD7_SUB_SRCCD”" Else ““PS_JWD_ACCOUNT””."“J_LOD7_OBJAC_SRCCD”" End Else ““PS_JWD_ACCOUNT””."“J_LOD6_OBJAC_SRCCD”" End , ““PS_MKF_GL_SUM_MV””."“J_DOC_TYPE”" , ““PS_JWD_ACCOUNT””."“J_ACCOUNT_DESC”" Order By 3 and ““PS_MKF_GL_SUM_MV””."“J_CAL_MONTH_ID”" = 202106–TO_CHAR (ADD_MONTHS (SYSDATE, -1), ‘YYYYMM’)"

image

This part of your code:

‘YYYYMM’)"

The single quotes surrounding this format value do not look like single quotes.