AnsweredAssumed Answered

ORA-01843: not a valid month

Question asked by Lowell on Jun 30, 2015
Latest reply on Jun 30, 2015 by Lowell

How do I get around the GEL SQL Query problem with comparing dates?  ORA-01843: not a valid month at   When I run the following query?  Is there a way to Fill in for Null dates?  How do you compare dates?

 

 

 

 

      <sql:query escapeText="false" var="v_obj_count">
SELECT Count(OT.INVESTMENT_ID) as num
FROM

(
SELECT
V1.INVESTMENT_ID,
V1.INVESTMENT_NAME,
V1.INVESTMENT_EXT_ID,
V1.TRG_TASK_PKID,
V1.TASK_PRID,
V1.OCTP_PRFINISH,
V1.TRG_POR_MILESTONE,
V1.TASK_NAME,
V1.TASK_PREXTERNALID,
V1.outlineLevel,
V1.TASK_PRSTATUS,
V1.TASK_PRFINISH
FROM

(SELECT
OCTP.ODF_PARENT_ID INVESTMENT_ID,
I.NAME INVESTMENT_NAME,
I.CODE INVESTMENT_EXT_ID,
OCTP.TRG_TASK_PKID,
OCTP.TRG_TSK_PKID_LKUP TASK_PRID,
TO_DATE(OCTP.TRG_TSK_FINISH_DT,'MM-DD-YYYY') OCTP_PRFINISH,
OCT.TRG_POR_MILESTONE,
TSK.PRNAME TASK_NAME,
TSK.PREXTERNALID TASK_PREXTERNALID,
TSK.PRMSPWBSLEVEL outlineLevel,
TSK.PRSTATUS TASK_PRSTATUS,
TO_DATE(TSK.PRFINISH,'MM-DD-YYYY') TASK_PRFINISH

FROM odf_ca_trg_por_ms_hist_obj OCTP
INNER JOIN INV_INVESTMENTS I ON OCTP.ODF_PARENT_ID = I.ID
INNER JOIN PRTASK TSK ON OCTP.TRG_TASK_PKID = TSK.PRID
INNER JOIN ODF_CA_TASK OCT ON TSK.PRID = OCT.ID
WHERE I.IS_ACTIVE = 1
AND TSK.PRSTATUS != 2
) V1
WHERE TO_DATE(V1.TASK_PRFINISH,'MM-DD-YYYY') != TO_DATE(V1.OCTP_PRFINISH,'MM-DD-YYYY')

) OT


      </sql:query>

 

Outcomes