已将条件添加到查询结果中,而没有记录被提取

时间:2019-05-17 11:19:42

标签: sql oracle peoplesoft

当我在查询中添加以下条件时,它不再返回任何值。我不明白这一点,因为它涵盖了什么时候都没有价值 提供给以下提示,应该可以正常工作。有什么想法吗?

(( A.EMPLID = :3 OR  A.EMPLID = :4 OR  A.EMPLID = :5 OR  A.EMPLID = :6 OR  
A.EMPLID = :7) OR (' ' = :3 AND ' ' = :4 AND ' ' = :5 AND ' ' = :6 AND ' ' 
= :7)) AND NVL( A.INVOICE_ID, ' ') LIKE DECODE (:8, ' ', '%', :8)

完整查询:

SELECT DISTINCT A.INSTITUTION, A.ACAD_PROG, A.FIRST_NAME, A.LAST_NAME, 
A.SECOND_LAST_NAME, A.COMPANY_DESCR, A.I4_SALES_PRICE, A.TOTAL_BILL, 
A.TOTAL_PAYMENT, A.I4_PAYERNAME, A.INVOICE_ID, A.I4_CREDIT_MEMO, 
A.BILLED_AMOUNT, A.PAYMENT_RECEIVED, A.I4_CMSRVC_DESCR, A.I4_TOTAL_SALES, 
A.I4_TOTAL_PAID, TO_CHAR(A.POSTED_DATE,'YYYY-MM-DD'), A.EMPLID, ROW_NUMBER() 
OVER (Partition BY  A.EMPLID ORDER BY  A.EMPLID), 
TO_CHAR(A.PAYMENT_DT,'YYYY-MM-DD'), TO_CHAR(A.I4_PAY_PLAN_DT,'YYYY-MM-DD'), 
A.FLAG, A.DISTRIB_AMT, ROW_NUMBER() OVER (Partition BY  A.EMPLID,  
A.INVOICE_ID,  A.BILLED_AMOUNT  ORDER BY  A.INVOICE_ID),  A.BILLED_AMOUNT - 
A.TOTAL_PAYMENT, ROW_NUMBER() OVER ( PARTITION BY  A.EMPLID ,  A.INVOICE_ID,  
TO_CHAR(A.POSTED_DATE,'YYYY-MM-DD'),  A.PAYMENT_RECEIVED,  
TO_CHAR(A.I4_PAY_PLAN_DT,'YYYY-MM-DD'),  A.PAYMENT_ID_NBR ORDER BY  
A.EMPLID), A.PROG_ACTION, A.COUNT_1, ROW_NUMBER() OVER (Partition BY  
A.EMPLID,  A.INVOICE_ID,  A.BILLED_AMOUNT ORDER BY  A.EMPLID,  A.INVOICE_ID,  
TO_CHAR(A.POSTED_DATE,'YYYY-MM-DD'),  TO_CHAR(A.PAYMENT_DT,'YYYY-MM-DD')), 
A.SORT, ROW_NUMBER() OVER (Partition BY  A.EMPLID,  A.INVOICE_ID,  
TO_CHAR(A.POSTED_DATE,'YYYY-MM-DD'),  A.PAYMENT_RECEIVED,  A.PAYMENT_ID_NBR 
ORDER BY  A.EMPLID,  A.INVOICE_ID,  TO_CHAR(A.POSTED_DATE,'YYYY-MM-DD'),  
TO_CHAR(A.PAYMENT_DT,'YYYY-MM-DD'),  A.PAYMENT_ID_NBR ), A.PAYMENT_ID_NBR 
  FROM PS_CUSTOM_TBL A 
  WHERE ( 1 = 1 AND  A.INSTITUTION = 'IESE' AND  A.ACAD_CAREER = :1 AND  
A.ACAD_PROG = :2 AND (( A.EMPLID = :3 OR  A.EMPLID = :4 OR  A.EMPLID = :5 OR  
A.EMPLID = :6 OR  A.EMPLID = :7) OR (' ' = :3 AND ' ' = :4 AND ' ' = :5 AND 
' ' = :6 AND ' ' = :7)) AND NVL( A.INVOICE_ID, ' ') LIKE DECODE (:8, ' ', 
'%', :8);

0 个答案:

没有答案