如何指出特定的过滤器以防止代码产生正确的结果

时间:2019-04-05 12:49:01

标签: sql oracle

我有一个代码可以提供广泛的结果,但是由于我不知道是什么原因而无法提供一些(157)特定项目。我想知道代码中的哪个过滤器正在阻止这些特定项目出现在结果中。该项目“ CG0133662”未显示在结果中,如何实现/如何实现以查看哪个过滤器阻止了它的显示。我应该修改什么以及如何防止这种情况发生。请帮忙。

SELECT
    R.DESCRIPTION "REGION",  
    A.POL_NUM , 
    PH.PH_ID,
    PH.PH_NAME  , 
    PH.EASY_ID,
    A.EFF_DATE,
    A.EXP_DATE,
    (
        SELECT MAX(T.TRACK_DATE_RECEIVED)
        FROM TRACKING T
        WHERE T.TRACK_APP_NUM = A.APP_NUM
        AND TRACK_APP_STATUS = '5'
    ) ISSUE_DATE,
    A.NEW_RENEWAL,
    CSL.DESCRIPTION SEGMENTATION,
    P.PRODUCT_DESCRIPTION,
     (SELECT COUNT(CD.DEBT_NUM)
        FROM COVERAGE_DETAIL CD
        WHERE CD.APP_NUM = A.APP_NUM
         AND CD.ACTION in ('1','3','5')
        AND cd.CANCELDATE IS NULL
     ) ACTIVE_BUYER_COUNT,
    A.PREMIUM
FROM 
    POLICY_HOLDER PH, 
    APPLICATION A, 
    REGIONS R, 
    AGENCY_REGION AR, 
    POLICY_FORM PF , 
    APP_STATUS APS,
    CLIENT_SEGMENTATION_LEVEL CSL,
    PRODUCT P
WHERE
A.PH_ID = PH.PH_ID
AND A.POLICY_FORM = PF.CODE
AND AR.AGENCY_ID = A.AGENCY_ID
AND AR.REGION = R.REGION
AND A.APP_STATUS  = APS.CODE
AND PH.CLIENTS_SEGMENTATION = CSL.ID
AND A.PRODUCT_ID = P.PRODUCT_ID
AND A.POLICY_FORM IN ( '5','6' ) -- EXCLUDE EDC 
--AND A.OWNER_CODE = '5' -- CNAIC
AND PH.CGS IS NULL -- EXCLUDE CGS
AND A.EXP_DATE > SYSDATE
--AND A.EFF_DATE BETWEEN TO_DATE ( '01/01/2017', 'MM/DD/YYYY' ) AND TO_DATE ( '12/31/2017', 'MM/DD/YYYY' ) -- effective in 2017
AND A.APP_STATUS= '5'  -- Active policies
ORDER BY REGION, EFF_DATE;

0 个答案:

没有答案