PS查询中的日期标准

时间:2018-06-05 14:18:51

标签: sql oracle peoplesoft

我的PS查询有这个标准:

录取数据创建(日期) 这是一个FROM日期。从选定日期开始到当前日期的所有记录都将包含在报告中。保留此空白将默认为当前日期。

我在下面进行了查询:

  WHERE ( ( A.EMPLID = B.EMPLID 
     AND A.EMPLID = E.EMPLID 
     AND H.EFFDT = 
        (SELECT MAX(H_ED.EFFDT) FROM PS_ACAD_PROG_CAF H_ED 
        WHERE H.INSTITUTION = H_ED.INSTITUTION 
          AND H.ACAD_PROG = H_ED.ACAD_PROG 
          AND H_ED.EFFDT <= SYSDATE) 
     AND A.EMPLID = C.EMPLID 
     AND C.INSTITUTION = A.INSTITUTION 
     AND C.INSTITUTION = D.INSTITUTION 
     AND C.SAD_UC_APPCODE = D.SAD_UC_APPCODE 
     AND C.SAD_UC_PERS_ID = D.SAD_UC_PERS_ID 
     AND C.INSTITUTION = F.INSTITUTION 
     AND C.SAD_UC_APPCODE = F.SAD_UC_APPCODE 
     AND C.SAD_UC_PERS_ID = F.SAD_UC_PERS_ID 
     AND F.EFFDT = 
        (SELECT MAX(F_ED.EFFDT) FROM PS_UM_CTXT_PERCTXT F_ED 
        WHERE F.INSTITUTION = F_ED.INSTITUTION 
          AND F.SAD_UC_APPCODE = F_ED.SAD_UC_APPCODE 
          AND F.SAD_UC_PERS_ID = F_ED.SAD_UC_PERS_ID 
          AND F_ED.EFFDT <= SYSDATE) 
    AND F.EFFSEQ = 
        (SELECT MAX(F_ES.EFFSEQ) FROM PS_UM_CTXT_PERCTXT F_ES 
        WHERE F.INSTITUTION = F_ES.INSTITUTION 
          AND F.SAD_UC_APPCODE = F_ES.SAD_UC_APPCODE 
          AND F.SAD_UC_PERS_ID = F_ES.SAD_UC_PERS_ID 
          AND F.EFFDT = F_ES.EFFDT) 
     AND D.INSTITUTION = G.INSTITUTION 
     AND D.SAD_UC_PERS_ID = G.SAD_UC_PERS_ID 
     AND D.SAD_UC_APPCODE = G.SAD_UC_APPCODE 
     AND D.SAD_UC_CHOICENO = G.SAD_UC_CHOICENO 
     AND H.SCC_CAF_ATTR_SEQ = 1 
     AND H.SCC_CAF_ATTRIB_NM = 'UM_MDAS_MAP' 
     AND H.SCC_CAF_ATTR_VAL IN ('MAP','MDAS') 
     AND G.SAD_UC_ABBREVCODE = 'AC' 
     AND F.UM_CTXT_WP_FLAG = 'Y' 
     AND F.UM_CTXT_WPPLS_FLAG = 'Y' 
     AND A.INSTITUTION = :1 
     AND ( A.ACAD_CAREER = :2 
     OR ' ' = :2) 
     AND 1 = 1 AND (  A.EMPLID = :4
OR ' ' = :4) 
     AND ( TO_DATE(:3,'YYYY-MM-DD') IS NULL 
     OR A.ADM_CREATION_DT >= 
     TO_DATE(TO_CHAR(SYSDATE,'YYYY-MM-DD'),'YYYY-MM-DD')) 
     AND A.ADM_CREATION_DT <= 
     TO_DATE(TO_CHAR(SYSDATE,'YYYY-MM-DD'),'YYYY-MM-DD') )) 
  ORDER BY 1, 5, 2, 6

如果您能看到上述标准的一部分就是这个:

     AND ( TO_DATE(:3,'YYYY-MM-DD') IS NULL 
     OR A.ADM_CREATION_DT >= 
     TO_DATE(TO_CHAR(SYSDATE,'YYYY-MM-DD'),'YYYY-MM-DD')) 
     AND A.ADM_CREATION_DT <= 
     TO_DATE(TO_CHAR(SYSDATE,'YYYY-MM-DD'),'YYYY-MM-DD') )) 

问题是它没有拉动我想要的东西,我尝试了不同的方法来做到这一点,但得到类似日期格式错误的东西。自上周以来一直遇到这个问题。真的需要有关如何将标准添加到我的PS查询的帮助。

0 个答案:

没有答案