1 Reply Latest reply: Sep 11, 2017 10:56 AM by Sunny Talwar RSS

    Help in syntax

    Ali Hijazi

      Hello

      I got the following SQL query

      SELECT

          DISTINCT CAS.PYID AS CASE_ID,

              CAS.PXUPDATEDATETIME AS CASE_ROW_LASTMANT_DTTM,

              LNK.ROW_ADDED_DTTM AS LINK_ROW_LASTMANT_DTTM,

              NVL(DEF.R_DEFECT_ID, DP.R_DEFECT_ID) AS DEFECT_ID,

              DEF.ROW_LASTMANT_DTTM AS DEF_ROW_LASTMANT_DTTM,

              DP.SEQNO AS SEQNO,

              DP.ROW_LASTMANT_DTTM AS DP_ROW_LASTMANT_DTTM,

              FIXMX.R_FIX_ID AS FIX_ID,

              FIX.ROW_LASTMANT_DTTM AS FIX_ROW_LASTMANT_DTTM,

             

             MR.R_DEFECT_ID || ' | ' || MR.COMPANYID || ' | ' || MR.R_PRODUCTION_ID || ' | ' || MR.PROJECT_ID as MERGE_REQ_KEY,

              MR.R_DEFECT_ID , MR.COMPANYID , MR.R_PRODUCTION_ID , MR.PROJECT_ID as MERGE_REQ_KEY,

             

              MR.ROW_LASTMANT_DTTM AS MR_ROW_LASTMANT_DTTM,

              VP.PLANNING_ID_MX AS VP_ID,

              VP.ROW_LASTMANT_DTTM AS VP_ROW_LASTMANT_DTTM

             

          FROM DATA.MXCS_FW_WORK_CASE@CRMTSTB2PEGACSDEV CAS

              FULL OUTER JOIN SYSADM.PS_RQ_DEF_PEGA_MX LNK

                  ON LNK.RELATED_OBJ_ID = CAS.PYID

              FULL OUTER JOIN SYSADM.PS_RQ_DEFECT DEF

                  ON DEF.R_DEFECT_ID = LNK.R_DEFECT_ID

              LEFT JOIN SYSADM.PS_RQ_AFFECTD_PROD DP

                  ON DP.R_DEFECT_ID = DEF.R_DEFECT_ID

              LEFT JOIN SYSADM.PS_RQ_AFDCT_MX DPMX

                  ON DP.R_DEFECT_ID = DPMX.R_DEFECT_ID

                  AND DP.SEQNO = DPMX.SEQNO

              LEFT JOIN SYSADM.PS_RQ_FIX_MX FIXMX

                  ON FIXMX.R_DEFECT_ID = DP.R_DEFECT_ID AND FIXMX.DP_SEQNO_MX = DP.SEQNO

              LEFT JOIN SYSADM.PS_RQ_FIX FIX

                  ON FIXMX.R_FIX_ID = FIX.R_FIX_ID

              LEFT JOIN SYSADM.PS_RQ_DVLT_REQ_MX MR

                  ON MR.R_DEFECT_ID = DP.R_DEFECT_ID AND MR.VERSION2_MX = DP.R_PRODUCTION_ID

              FULL OUTER JOIN SYSADM.PS_RQ_PLNG_DFCT_MX

                  ON (PS_RQ_PLNG_DFCT_MX.R_DEFECT_ID = DEF.R_DEFECT_ID)

              LEFT JOIN SYSADM.PS_RQ_VPLANNING_MX VP

                  ON (VP.PLANNING_ID_MX = PS_RQ_PLNG_DFCT_MX.PLANNING_ID_MX)

       

      I want to put this query in a variable called vSQL as follows:

      let vSQL = ' above_text_here'

      but the highlighted line got also single quotes

      please advise on how to accomplish this