-1

I am trying to run below query in Oracle but getting this error. Any idea how to resolve?

SELECT DISTINCT t1.p_id "Id",
    (TO_CHAR("sysdate", 'YYYY') + least(SIGN(("sysdate" - to_date('01-Aug-' | | TO_CHAR("sysdate", 'YYYY'), 'DD-Mon-RRRR'))), 0)) "Year"

    FROM 
       t1,
       t7,
       t9
    WHERE 
       t9.ei_id(+)          = t7.e_id
    AND (t7.e_student        = t1.p_id)
    AND (t7.e_module         = t8.m_id)
    AND (NVL(t9.ei_q18m06, t7.e_end) > '31-Jul-' | | (TO_CHAR("sysdate", 'YYYY') + least(SIGN(("sysdate" - to_date('01-Aug-' | | TO_CHAR("sysdate", 'YYYY'), 'DD-Mon-RRRR'))), 0) + - 5))

Thanks, Aruna

4

2 回答 2

2

我认为你不需要在引号下给出 sysdate,只需给出 sysdate。目前它被当作字符串,所以给你无效的标识符错误。

于 2017-05-19T10:56:37.247 回答
1

正如 Vijay 所说,你应该这样写(我还修复了你| |可能导致其他错误的人:-> ||):

SELECT DISTINCT t1.p_id "Id",
(TO_CHAR(sysdate, 'YYYY') + least(SIGN((sysdate - to_date('01-Aug-' || TO_CHAR(sysdate, 'YYYY'), 'DD-Mon-RRRR'))), 0)) "Year"
FROM 
   t1,
   t7,
   t9
WHERE 
   t9.ei_id(+)          = t7.e_id
AND (t7.e_student        = t1.p_id)
AND (t7.e_module         = t8.m_id)
AND (NVL(t9.ei_q18m06, t7.e_end) > '31-Jul-' || (TO_CHAR(sysdate, 'YYYY') + least(SIGN((sysdate - to_date('01-Aug-' || TO_CHAR(sysdate, 'YYYY'), 'DD-Mon-RRRR'))), 0) + - 5))
于 2017-05-24T08:29:57.687 回答