ORA-01722:无效的号码-01722指定的号码无效

时间:2019-12-09 22:31:25

标签: sql oracle

有人可以在此查询中指出我的正确方向吗?

SELECT A.EMPLID,
       C.ACCOUNT_BALANCE,
       (sum(case
              when A.ITEM_TYPE BETWEEN 700000000000 AND 799999999999
                THEN abs( A.ITEM_AMT)
              ELSE 0
            END) +300), 
       sum((case
              when A.ITEM_TYPE < 600000000000  AND
                   (to_date(trunc(TO_CHAR(CAST((A.SCC_ROW_ADD_DTTM) AS TIMESTAMP),'YYYY-MM-DD-HH24.MI.SS.FF')) + 13/24)) < ADD_MONTHS(SYSDATE,-1)
                THEN ( A.ITEM_AMT) / :2 * :3
              ELSE 0
            end) +
           (case
              when A.ITEM_TYPE BETWEEN 600000000000 AND 699999999999 OR
                   A.ITEM_TYPE > 800000000000
                THEN (A.ITEM_AMT) / :2 * :3   ELSE 0 end) ) -
           (case
              when B.NET_AWARD_AMT is null
                THEN 0 
              ELSE (B.NET_AWARD_AMT) / :2 * :3
            END),
       A.ITEM_TYPE,
       B.NET_AWARD_AMT
  FROM (PS_ITEM_SF A
  LEFT OUTER JOIN PS_ANTC_AID_TERM B
    ON  B.EMPLID = A.EMPLID AND
        B.STRM = A.ACCOUNT_TERM), PS_ACCOUNT_TOT_VW C
  WHERE (A.EMPLID LIKE '1%' AND
         A.ACCOUNT_TERM = :1 AND
         C.EMPLID = A.EMPLID AND
         A.ITEM_AMT <> 0 AND
         C.ACCOUNT_BALANCE > 300 AND
         A.EMPLID NOT IN (SELECT D.EMPLID
                            FROM PS_SRVC_IND_DATA D
                            WHERE D.EMPLID = A.EMPLID AND
                                  D.SRVC_IND_CD IN ('ADV','B02') AND
                                  (D.SRVC_IND_ACTIVE_DT > SYSDATE OR 
                                   D.SCC_SI_END_TERM = ' ')))
  GROUP BY A.EMPLID,
           C.ACCOUNT_BALANCE,
           A.ITEM_TYPE,
           B.NET_AWARD_AMT
  HAVING ( (sum(case
                  when A.ITEM_TYPE BETWEEN 700000000000 AND 799999999999
                    THEN abs( A.ITEM_AMT)
                  ELSE 0   END) +300) < 1000)
  ORDER BY 1;

我是初学者! 非常感谢!

0 个答案:

没有答案