Oracle到PostgreSQL等價改寫

哎呀我的天吶發表於2022-06-09

直奔主題,原SQL是這樣的,在Oracle系統上比較快便執行出來了,執行計劃和SQL文字如下

select a.prd_code,
       a.targ_prd_code,
       a.seller_code,
       a.share_class,
       a.c_targetsharetype
from fund60trans1.tbfundcfmexptmp1_3 a,
     tbfundchangelimit b
where (a.prd_code = b.prd_code or b.prd_code = '*')
  and (a.share_class = b.share_class or b.share_class = '*')
  and (a.seller_code = b.seller_code or b.seller_code = '*')
  and (a.targ_prd_code = b.targ_prd_code or b.targ_prd_code = '*')
  and (a.c_targetsharetype = b.targ_share_class or b.targ_share_class = '*');

執行到PostgreSQL上走nested loop join遲遲不出結果,執行計劃如下


強制走hash join呢?

指定此 hint /*+hashjoin(a b) parallel(a 2 hard) parallel(b 3 hard)*/,看到這種情況 PostgreSQL還是不走hash join的,因為條件中有or,有or的情況優化器是走不了hash join,看cost 100000000000,PostgreSQL認為走nested loop cost無限大,但是他又不能走hash join和merge join,只能不得不走nested loop,那麼如上這種sql對於postgresql來講變無能為力了

改SQL

SELECT vm_tmp.ITEM_1 PRD_CODE,
       vm_tmp.ITEM_2 TARG_PRD_CODE,
       vm_tmp.ITEM_3 SELLER_CODE,
       vm_tmp.ITEM_4 SHARE_CLASS,
       vm_tmp.ITEM_5 C_TARGETSHARETYPE
FROM ((SELECT A.PRD_CODE          ITEM_1,
              A.TARG_PRD_CODE     ITEM_2,
              A.SELLER_CODE       ITEM_3,
              A.SHARE_CLASS       ITEM_4,
              A.C_TARGETSHARETYPE ITEM_5
       FROM TBFUNDCHANGELIMIT B,
            TBFUNDC3EXPTMP1 A
       WHERE B.PRD_CODE = '*'
         AND B.SHARE_CLASS = '*'
         AND B.SELLER_CODE = '*'
         AND B.TARG_PRD_CODE = '*'
         AND B.TARG_SHARE_CLASS = '*')
      UNION ALL
      ((SELECT A.PRD_CODE          ITEM_1,
               A.TARG_PRD_CODE     ITEM_2,
               A.SELLER_CODE       ITEM_3,
               A.SHARE_CLASS       ITEM_4,
               A.C_TARGETSHARETYPE ITEM_5
        FROM TBFUNDCHANGELIMIT B,
             TBFUNDC3EXPTMP1 A
        WHERE A.PRD_CODE = B.PRD_CODE
          AND B.SHARE_CLASS = '*'
          AND B.SELLER_CODE = '*'
          AND B.TARG_PRD_CODE = '*'
          AND B.TARG_SHARE_CLASS = '*'
          AND lnnvl(B.PRD_CODE = '*'))
       UNION ALL
       ((SELECT A.PRD_CODE          ITEM_1,
                A.TARG_PRD_CODE     ITEM_2,
                A.SELLER_CODE       ITEM_3,
                A.SHARE_CLASS       ITEM_4,
                A.C_TARGETSHARETYPE ITEM_5
         FROM TBFUNDCHANGELIMIT B,
              TBFUNDC3EXPTMP1 A
         WHERE B.PRD_CODE = '*'
           AND A.SHARE_CLASS = B.SHARE_CLASS
           AND B.SELLER_CODE = '*'
           AND B.TARG_PRD_CODE = '*'
           AND B.TARG_SHARE_CLASS = '*'
           AND lnnvl(B.SHARE_CLASS = '*')
           AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*')))
        UNION ALL
        ((SELECT A.PRD_CODE          ITEM_1,
                 A.TARG_PRD_CODE     ITEM_2,
                 A.SELLER_CODE       ITEM_3,
                 A.SHARE_CLASS       ITEM_4,
                 A.C_TARGETSHARETYPE ITEM_5
          FROM TBFUNDCHANGELIMIT B,
               TBFUNDC3EXPTMP1 A
          WHERE B.PRD_CODE = '*'
            AND B.SHARE_CLASS = '*'
            AND A.SELLER_CODE = B.SELLER_CODE
            AND B.TARG_PRD_CODE = '*'
            AND B.TARG_SHARE_CLASS = '*'
            AND lnnvl(B.SELLER_CODE = '*')
            AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SELLER_CODE = '*'))
            AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR lnnvl(B.SELLER_CODE = '*')))
         UNION ALL
         ((SELECT A.PRD_CODE          ITEM_1,
                  A.TARG_PRD_CODE     ITEM_2,
                  A.SELLER_CODE       ITEM_3,
                  A.SHARE_CLASS       ITEM_4,
                  A.C_TARGETSHARETYPE ITEM_5
           FROM TBFUNDCHANGELIMIT B,
                TBFUNDC3EXPTMP1 A
           WHERE B.PRD_CODE = '*'
             AND B.SHARE_CLASS = '*'
             AND B.SELLER_CODE = '*'
             AND A.TARG_PRD_CODE = B.TARG_PRD_CODE
             AND B.TARG_SHARE_CLASS = '*'
             AND lnnvl(B.TARG_PRD_CODE = '*')
             AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.TARG_PRD_CODE = '*'))
             AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR lnnvl(B.TARG_PRD_CODE = '*'))
             AND (lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR lnnvl(B.TARG_PRD_CODE = '*')))
          UNION ALL
          ((SELECT A.PRD_CODE          ITEM_1,
                   A.TARG_PRD_CODE     ITEM_2,
                   A.SELLER_CODE       ITEM_3,
                   A.SHARE_CLASS       ITEM_4,
                   A.C_TARGETSHARETYPE ITEM_5
            FROM TBFUNDCHANGELIMIT B,
                 TBFUNDC3EXPTMP1 A
            WHERE B.PRD_CODE = '*'
              AND B.SHARE_CLASS = '*'
              AND B.SELLER_CODE = '*'
              AND B.TARG_PRD_CODE = '*'
              AND A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS
              AND lnnvl(B.TARG_SHARE_CLASS = '*')
              AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.TARG_SHARE_CLASS = '*'))
              AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR lnnvl(B.TARG_SHARE_CLASS = '*'))
              AND (lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR lnnvl(B.TARG_SHARE_CLASS = '*'))
              AND (lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR lnnvl(B.TARG_SHARE_CLASS = '*')))
           UNION ALL
           ((SELECT A.PRD_CODE          ITEM_1,
                    A.TARG_PRD_CODE     ITEM_2,
                    A.SELLER_CODE       ITEM_3,
                    A.SHARE_CLASS       ITEM_4,
                    A.C_TARGETSHARETYPE ITEM_5
             FROM TBFUNDCHANGELIMIT B,
                  TBFUNDC3EXPTMP1 A
             WHERE A.PRD_CODE = B.PRD_CODE
               AND A.SHARE_CLASS = B.SHARE_CLASS
               AND B.SELLER_CODE = '*'
               AND B.TARG_PRD_CODE = '*'
               AND B.TARG_SHARE_CLASS = '*'
               AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*'))
               AND lnnvl(B.SHARE_CLASS = '*')
               AND lnnvl(B.PRD_CODE = '*')
               AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                    lnnvl(A.SELLER_CODE = B.SELLER_CODE))
               AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                    lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE))
               AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                    lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS)))
            UNION ALL
            ((SELECT A.PRD_CODE          ITEM_1,
                     A.TARG_PRD_CODE     ITEM_2,
                     A.SELLER_CODE       ITEM_3,
                     A.SHARE_CLASS       ITEM_4,
                     A.C_TARGETSHARETYPE ITEM_5
              FROM TBFUNDCHANGELIMIT B,
                   TBFUNDC3EXPTMP1 A
              WHERE A.PRD_CODE = B.PRD_CODE
                AND B.SHARE_CLASS = '*'
                AND A.SELLER_CODE = B.SELLER_CODE
                AND B.TARG_PRD_CODE = '*'
                AND B.TARG_SHARE_CLASS = '*'
                AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SELLER_CODE = '*'))
                AND lnnvl(B.SELLER_CODE = '*')
                AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                     lnnvl(B.SELLER_CODE = '*'))
                AND lnnvl(B.PRD_CODE = '*')
                AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                     lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE))
                AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                     lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR lnnvl(B.SELLER_CODE = '*')))
             UNION ALL
             ((SELECT A.PRD_CODE          ITEM_1,
                      A.TARG_PRD_CODE     ITEM_2,
                      A.SELLER_CODE       ITEM_3,
                      A.SHARE_CLASS       ITEM_4,
                      A.C_TARGETSHARETYPE ITEM_5
               FROM TBFUNDCHANGELIMIT B,
                    TBFUNDC3EXPTMP1 A
               WHERE A.PRD_CODE = B.PRD_CODE
                 AND B.SHARE_CLASS = '*'
                 AND B.SELLER_CODE = '*'
                 AND A.TARG_PRD_CODE = B.TARG_PRD_CODE
                 AND B.TARG_SHARE_CLASS = '*'
                 AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*'))
                 AND lnnvl(B.TARG_PRD_CODE = '*')
                 AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                      lnnvl(B.TARG_PRD_CODE = '*'))
                 AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR
                      lnnvl(B.TARG_PRD_CODE = '*'))
                 AND lnnvl(B.PRD_CODE = '*')
                 AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*') OR
                      lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                 AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR lnnvl(B.TARG_PRD_CODE = '*'))
                 AND (lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR lnnvl(B.TARG_PRD_CODE = '*')))
              UNION ALL
              ((SELECT A.PRD_CODE          ITEM_1,
                       A.TARG_PRD_CODE     ITEM_2,
                       A.SELLER_CODE       ITEM_3,
                       A.SHARE_CLASS       ITEM_4,
                       A.C_TARGETSHARETYPE ITEM_5
                FROM TBFUNDCHANGELIMIT B,
                     TBFUNDC3EXPTMP1 A
                WHERE A.PRD_CODE = B.PRD_CODE
                  AND B.SHARE_CLASS = '*'
                  AND B.SELLER_CODE = '*'
                  AND B.TARG_PRD_CODE = '*'
                  AND A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS
                  AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                  AND lnnvl(B.TARG_SHARE_CLASS = '*')
                  AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                       lnnvl(B.TARG_SHARE_CLASS = '*'))
                  AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR
                       lnnvl(B.TARG_SHARE_CLASS = '*'))
                  AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR
                       lnnvl(B.TARG_SHARE_CLASS = '*'))
                  AND lnnvl(B.PRD_CODE = '*')
                  AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                  AND (lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                  AND (lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR lnnvl(B.TARG_SHARE_CLASS = '*')))
               UNION ALL
               ((SELECT A.PRD_CODE          ITEM_1,
                        A.TARG_PRD_CODE     ITEM_2,
                        A.SELLER_CODE       ITEM_3,
                        A.SHARE_CLASS       ITEM_4,
                        A.C_TARGETSHARETYPE ITEM_5
                 FROM TBFUNDCHANGELIMIT B,
                      TBFUNDC3EXPTMP1 A
                 WHERE B.PRD_CODE = '*'
                   AND A.SHARE_CLASS = B.SHARE_CLASS
                   AND A.SELLER_CODE = B.SELLER_CODE
                   AND B.TARG_PRD_CODE = '*'
                   AND B.TARG_SHARE_CLASS = '*'
                   AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.SELLER_CODE = '*'))
                   AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*') OR
                        lnnvl(B.SELLER_CODE = '*'))
                   AND lnnvl(B.SELLER_CODE = '*')
                   AND lnnvl(B.SHARE_CLASS = '*')
                   AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                        lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE))
                   AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                        lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                   AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SELLER_CODE = '*'))
                   AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*'))
                   AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*') OR
                        lnnvl(B.SELLER_CODE = '*') OR lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE))
                   AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*') OR
                        lnnvl(B.SELLER_CODE = '*') OR lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS)))
                UNION ALL
                ((SELECT A.PRD_CODE          ITEM_1,
                         A.TARG_PRD_CODE     ITEM_2,
                         A.SELLER_CODE       ITEM_3,
                         A.SHARE_CLASS       ITEM_4,
                         A.C_TARGETSHARETYPE ITEM_5
                  FROM TBFUNDCHANGELIMIT B,
                       TBFUNDC3EXPTMP1 A
                  WHERE B.PRD_CODE = '*'
                    AND A.SHARE_CLASS = B.SHARE_CLASS
                    AND B.SELLER_CODE = '*'
                    AND A.TARG_PRD_CODE = B.TARG_PRD_CODE
                    AND B.TARG_SHARE_CLASS = '*'
                    AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.TARG_PRD_CODE = '*'))
                    AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*') OR
                         lnnvl(B.TARG_PRD_CODE = '*'))
                    AND lnnvl(B.TARG_PRD_CODE = '*')
                    AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR
                         lnnvl(B.TARG_PRD_CODE = '*'))
                    AND lnnvl(B.SHARE_CLASS = '*')
                    AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.TARG_PRD_CODE = '*') OR
                         lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                    AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.TARG_PRD_CODE = '*'))
                    AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*') OR
                         lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR lnnvl(B.TARG_PRD_CODE = '*'))
                    AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*'))
                    AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*') OR
                         lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                    AND (lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR lnnvl(B.TARG_PRD_CODE = '*')))
                 UNION ALL
                 ((SELECT A.PRD_CODE          ITEM_1,
                          A.TARG_PRD_CODE     ITEM_2,
                          A.SELLER_CODE       ITEM_3,
                          A.SHARE_CLASS       ITEM_4,
                          A.C_TARGETSHARETYPE ITEM_5
                   FROM TBFUNDCHANGELIMIT B,
                        TBFUNDC3EXPTMP1 A
                   WHERE B.PRD_CODE = '*'
                     AND A.SHARE_CLASS = B.SHARE_CLASS
                     AND B.SELLER_CODE = '*'
                     AND B.TARG_PRD_CODE = '*'
                     AND A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS
                     AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                     AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*') OR
                          lnnvl(B.TARG_SHARE_CLASS = '*'))
                     AND lnnvl(B.TARG_SHARE_CLASS = '*')
                     AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR
                          lnnvl(B.TARG_SHARE_CLASS = '*'))
                     AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR
                          lnnvl(B.TARG_SHARE_CLASS = '*'))
                     AND lnnvl(B.SHARE_CLASS = '*')
                     AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                     AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*') OR
                          lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                     AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*') OR
                          lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                     AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*'))
                     AND (lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                     AND (lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR lnnvl(B.TARG_SHARE_CLASS = '*')))
                  UNION ALL
                  ((SELECT A.PRD_CODE          ITEM_1,
                           A.TARG_PRD_CODE     ITEM_2,
                           A.SELLER_CODE       ITEM_3,
                           A.SHARE_CLASS       ITEM_4,
                           A.C_TARGETSHARETYPE ITEM_5
                    FROM TBFUNDCHANGELIMIT B,
                         TBFUNDC3EXPTMP1 A
                    WHERE B.PRD_CODE = '*'
                      AND B.SHARE_CLASS = '*'
                      AND A.SELLER_CODE = B.SELLER_CODE
                      AND A.TARG_PRD_CODE = B.TARG_PRD_CODE
                      AND B.TARG_SHARE_CLASS = '*'
                      AND (lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*'))
                      AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SELLER_CODE = '*') OR
                           lnnvl(B.TARG_PRD_CODE = '*'))
                      AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR lnnvl(B.SELLER_CODE = '*') OR
                           lnnvl(B.TARG_PRD_CODE = '*'))
                      AND lnnvl(B.TARG_PRD_CODE = '*')
                      AND lnnvl(B.SELLER_CODE = '*')
                      AND (lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*') OR
                           lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                      AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                           lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*'))
                      AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.TARG_PRD_CODE = '*'))
                      AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SELLER_CODE = '*'))
                      AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SELLER_CODE = '*') OR
                           lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                      AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR lnnvl(B.TARG_PRD_CODE = '*'))
                      AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR lnnvl(B.SELLER_CODE = '*'))
                      AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR lnnvl(B.SELLER_CODE = '*') OR
                           lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS)))
                   UNION ALL
                   ((SELECT A.PRD_CODE          ITEM_1,
                            A.TARG_PRD_CODE     ITEM_2,
                            A.SELLER_CODE       ITEM_3,
                            A.SHARE_CLASS       ITEM_4,
                            A.C_TARGETSHARETYPE ITEM_5
                     FROM TBFUNDCHANGELIMIT B,
                          TBFUNDC3EXPTMP1 A
                     WHERE B.PRD_CODE = '*'
                       AND B.SHARE_CLASS = '*'
                       AND A.SELLER_CODE = B.SELLER_CODE
                       AND B.TARG_PRD_CODE = '*'
                       AND A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS
                       AND (lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                       AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SELLER_CODE = '*') OR
                            lnnvl(B.TARG_SHARE_CLASS = '*'))
                       AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR lnnvl(B.SELLER_CODE = '*') OR
                            lnnvl(B.TARG_SHARE_CLASS = '*'))
                       AND lnnvl(B.TARG_SHARE_CLASS = '*')
                       AND (lnnvl(B.SELLER_CODE = '*') OR lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR
                            lnnvl(B.TARG_SHARE_CLASS = '*'))
                       AND lnnvl(B.SELLER_CODE = '*')
                       AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                            lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                       AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                       AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SELLER_CODE = '*') OR
                            lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                       AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SELLER_CODE = '*'))
                       AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                       AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR lnnvl(B.SELLER_CODE = '*') OR
                            lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                       AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR lnnvl(B.SELLER_CODE = '*'))
                       AND (lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR lnnvl(B.TARG_SHARE_CLASS = '*')))
                    UNION ALL
                    ((SELECT A.PRD_CODE          ITEM_1,
                             A.TARG_PRD_CODE     ITEM_2,
                             A.SELLER_CODE       ITEM_3,
                             A.SHARE_CLASS       ITEM_4,
                             A.C_TARGETSHARETYPE ITEM_5
                      FROM TBFUNDCHANGELIMIT B,
                           TBFUNDC3EXPTMP1 A
                      WHERE B.PRD_CODE = '*'
                        AND B.SHARE_CLASS = '*'
                        AND B.SELLER_CODE = '*'
                        AND A.TARG_PRD_CODE = B.TARG_PRD_CODE
                        AND A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS
                        AND (lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                        AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.TARG_PRD_CODE = '*') OR
                             lnnvl(B.TARG_SHARE_CLASS = '*'))
                        AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR lnnvl(B.TARG_PRD_CODE = '*') OR
                             lnnvl(B.TARG_SHARE_CLASS = '*'))
                        AND (lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR lnnvl(B.TARG_PRD_CODE = '*') OR
                             lnnvl(B.TARG_SHARE_CLASS = '*'))
                        AND lnnvl(B.TARG_SHARE_CLASS = '*')
                        AND lnnvl(B.TARG_PRD_CODE = '*')
                        AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                             lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                        AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR
                             lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                        AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                        AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.TARG_PRD_CODE = '*'))
                        AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                             lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR lnnvl(B.TARG_PRD_CODE = '*') OR
                             lnnvl(B.TARG_SHARE_CLASS = '*'))
                        AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                        AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR lnnvl(B.TARG_PRD_CODE = '*'))
                        AND (lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                        AND (lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR lnnvl(B.TARG_PRD_CODE = '*')))
                     UNION ALL
                     ((SELECT A.PRD_CODE          ITEM_1,
                              A.TARG_PRD_CODE     ITEM_2,
                              A.SELLER_CODE       ITEM_3,
                              A.SHARE_CLASS       ITEM_4,
                              A.C_TARGETSHARETYPE ITEM_5
                       FROM TBFUNDCHANGELIMIT B,
                            TBFUNDC3EXPTMP1 A
                       WHERE B.PRD_CODE = '*'
                         AND A.SHARE_CLASS = B.SHARE_CLASS
                         AND A.SELLER_CODE = B.SELLER_CODE
                         AND A.TARG_PRD_CODE = B.TARG_PRD_CODE
                         AND B.TARG_SHARE_CLASS = '*'
                         AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                              lnnvl(B.TARG_PRD_CODE = '*'))
                         AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*') OR
                              lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*'))
                         AND (lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*'))
                         AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.TARG_PRD_CODE = '*'))
                         AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.SELLER_CODE = '*'))
                         AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                              lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                         AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SELLER_CODE = '*') OR
                              lnnvl(B.TARG_PRD_CODE = '*'))
                         AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*') OR
                              lnnvl(B.TARG_PRD_CODE = '*'))
                         AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*') OR
                              lnnvl(B.SELLER_CODE = '*'))
                         AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*') OR
                              lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*') OR
                              lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                         AND lnnvl(B.TARG_PRD_CODE = '*')
                         AND lnnvl(B.SELLER_CODE = '*')
                         AND (lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*') OR
                              lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                         AND lnnvl(B.SHARE_CLASS = '*')
                         AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.TARG_PRD_CODE = '*') OR
                              lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                         AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                              lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS)))
                      UNION ALL
                      ((SELECT A.PRD_CODE          ITEM_1,
                               A.TARG_PRD_CODE     ITEM_2,
                               A.SELLER_CODE       ITEM_3,
                               A.SHARE_CLASS       ITEM_4,
                               A.C_TARGETSHARETYPE ITEM_5
                        FROM TBFUNDCHANGELIMIT B,
                             TBFUNDC3EXPTMP1 A
                        WHERE B.PRD_CODE = '*'
                          AND A.SHARE_CLASS = B.SHARE_CLASS
                          AND A.SELLER_CODE = B.SELLER_CODE
                          AND B.TARG_PRD_CODE = '*'
                          AND A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS
                          AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                               lnnvl(B.TARG_SHARE_CLASS = '*'))
                          AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*') OR
                               lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                          AND (lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                          AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                          AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                               lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                          AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.SELLER_CODE = '*'))
                          AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SELLER_CODE = '*') OR
                               lnnvl(B.TARG_SHARE_CLASS = '*'))
                          AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*') OR
                               lnnvl(B.TARG_SHARE_CLASS = '*'))
                          AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*') OR
                               lnnvl(B.SELLER_CODE = '*') OR lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR
                               lnnvl(B.TARG_SHARE_CLASS = '*'))
                          AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*') OR
                               lnnvl(B.SELLER_CODE = '*'))
                          AND lnnvl(B.TARG_SHARE_CLASS = '*')
                          AND (lnnvl(B.SELLER_CODE = '*') OR lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR
                               lnnvl(B.TARG_SHARE_CLASS = '*'))
                          AND lnnvl(B.SELLER_CODE = '*')
                          AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR
                               lnnvl(B.TARG_SHARE_CLASS = '*'))
                          AND lnnvl(B.SHARE_CLASS = '*')
                          AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                               lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE))
                          AND (lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR lnnvl(B.TARG_SHARE_CLASS = '*')))
                       UNION ALL
                       ((SELECT A.PRD_CODE          ITEM_1,
                                A.TARG_PRD_CODE     ITEM_2,
                                A.SELLER_CODE       ITEM_3,
                                A.SHARE_CLASS       ITEM_4,
                                A.C_TARGETSHARETYPE ITEM_5
                         FROM TBFUNDCHANGELIMIT B,
                              TBFUNDC3EXPTMP1 A
                         WHERE A.PRD_CODE = B.PRD_CODE
                           AND B.SHARE_CLASS = '*'
                           AND A.SELLER_CODE = B.SELLER_CODE
                           AND B.TARG_PRD_CODE = '*'
                           AND A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS
                           AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                lnnvl(B.TARG_SHARE_CLASS = '*'))
                           AND (lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                           AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                                lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                           AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                           AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                           AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SELLER_CODE = '*'))
                           AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR lnnvl(B.SELLER_CODE = '*') OR
                                lnnvl(B.TARG_SHARE_CLASS = '*'))
                           AND lnnvl(B.TARG_SHARE_CLASS = '*')
                           AND (lnnvl(B.SELLER_CODE = '*') OR lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR
                                lnnvl(B.TARG_SHARE_CLASS = '*'))
                           AND lnnvl(B.SELLER_CODE = '*')
                           AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                                lnnvl(B.TARG_SHARE_CLASS = '*'))
                           AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                                lnnvl(B.SELLER_CODE = '*') OR lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR
                                lnnvl(B.TARG_SHARE_CLASS = '*'))
                           AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                                lnnvl(B.SELLER_CODE = '*'))
                           AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR
                                lnnvl(B.TARG_SHARE_CLASS = '*'))
                           AND lnnvl(B.PRD_CODE = '*')
                           AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE))
                           AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                                lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                           AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS)))
                        UNION ALL
                        ((SELECT A.PRD_CODE          ITEM_1,
                                 A.TARG_PRD_CODE     ITEM_2,
                                 A.SELLER_CODE       ITEM_3,
                                 A.SHARE_CLASS       ITEM_4,
                                 A.C_TARGETSHARETYPE ITEM_5
                          FROM TBFUNDCHANGELIMIT B,
                               TBFUNDC3EXPTMP1 A
                          WHERE B.PRD_CODE = '*'
                            AND A.SHARE_CLASS = B.SHARE_CLASS
                            AND B.SELLER_CODE = '*'
                            AND A.TARG_PRD_CODE = B.TARG_PRD_CODE
                            AND A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS
                            AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                 lnnvl(B.TARG_SHARE_CLASS = '*'))
                            AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*') OR
                                 lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                            AND (lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                            AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR
                                 lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                            AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                            AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.TARG_PRD_CODE = '*'))
                            AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                 lnnvl(B.TARG_SHARE_CLASS = '*'))
                            AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*') OR
                                 lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                 lnnvl(B.TARG_SHARE_CLASS = '*'))
                            AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*') OR
                                 lnnvl(B.TARG_SHARE_CLASS = '*'))
                            AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*') OR
                                 lnnvl(B.TARG_PRD_CODE = '*'))
                            AND (lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                 lnnvl(B.TARG_SHARE_CLASS = '*'))
                            AND lnnvl(B.TARG_SHARE_CLASS = '*')
                            AND lnnvl(B.TARG_PRD_CODE = '*')
                            AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR
                                 lnnvl(B.TARG_SHARE_CLASS = '*'))
                            AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR
                                 lnnvl(B.TARG_PRD_CODE = '*'))
                            AND lnnvl(B.SHARE_CLASS = '*')
                            AND (lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                            AND (lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR lnnvl(B.TARG_PRD_CODE = '*'))
                            AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*') OR
                                 lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR lnnvl(B.TARG_PRD_CODE = '*')))
                         UNION ALL
                         ((SELECT A.PRD_CODE          ITEM_1,
                                  A.TARG_PRD_CODE     ITEM_2,
                                  A.SELLER_CODE       ITEM_3,
                                  A.SHARE_CLASS       ITEM_4,
                                  A.C_TARGETSHARETYPE ITEM_5
                           FROM TBFUNDCHANGELIMIT B,
                                TBFUNDC3EXPTMP1 A
                           WHERE A.PRD_CODE = B.PRD_CODE
                             AND A.SHARE_CLASS = B.SHARE_CLASS
                             AND B.SELLER_CODE = '*'
                             AND B.TARG_PRD_CODE = '*'
                             AND A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS
                             AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                  lnnvl(B.TARG_SHARE_CLASS = '*'))
                             AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                             AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                             AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                  lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                             AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                  lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                             AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*'))
                             AND lnnvl(B.TARG_SHARE_CLASS = '*')
                             AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR
                                  lnnvl(B.TARG_SHARE_CLASS = '*'))
                             AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR
                                  lnnvl(B.TARG_SHARE_CLASS = '*'))
                             AND lnnvl(B.SHARE_CLASS = '*')
                             AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR
                                  lnnvl(B.TARG_SHARE_CLASS = '*'))
                             AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR
                                  lnnvl(B.TARG_SHARE_CLASS = '*'))
                             AND lnnvl(B.PRD_CODE = '*')
                             AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                  lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR
                                  lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                             AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                  lnnvl(A.SELLER_CODE = B.SELLER_CODE))
                             AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                  lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE))
                             AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR
                                  lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                             AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SELLER_CODE = B.SELLER_CODE))
                             AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(A.SELLER_CODE = B.SELLER_CODE))
                             AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE)))
                          UNION ALL
                          ((SELECT A.PRD_CODE          ITEM_1,
                                   A.TARG_PRD_CODE     ITEM_2,
                                   A.SELLER_CODE       ITEM_3,
                                   A.SHARE_CLASS       ITEM_4,
                                   A.C_TARGETSHARETYPE ITEM_5
                            FROM TBFUNDCHANGELIMIT B,
                                 TBFUNDC3EXPTMP1 A
                            WHERE A.PRD_CODE = B.PRD_CODE
                              AND B.SHARE_CLASS = '*'
                              AND B.SELLER_CODE = '*'
                              AND A.TARG_PRD_CODE = B.TARG_PRD_CODE
                              AND A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS
                              AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                   lnnvl(B.TARG_SHARE_CLASS = '*'))
                              AND (lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                              AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                                   lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                              AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR
                                   lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                              AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                              AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*'))
                              AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                   lnnvl(B.TARG_SHARE_CLASS = '*'))
                              AND (lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                   lnnvl(B.TARG_SHARE_CLASS = '*'))
                              AND lnnvl(B.TARG_SHARE_CLASS = '*')
                              AND lnnvl(B.TARG_PRD_CODE = '*')
                              AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                                   lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                   lnnvl(B.TARG_SHARE_CLASS = '*'))
                              AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                                   lnnvl(B.TARG_SHARE_CLASS = '*'))
                              AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                                   lnnvl(B.TARG_PRD_CODE = '*'))
                              AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR
                                   lnnvl(B.TARG_SHARE_CLASS = '*'))
                              AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR
                                   lnnvl(B.TARG_PRD_CODE = '*'))
                              AND lnnvl(B.PRD_CODE = '*')
                              AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                                   lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                              AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                                   lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR lnnvl(B.TARG_PRD_CODE = '*'))
                              AND (lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR lnnvl(B.TARG_PRD_CODE = '*'))
                              AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS))
                              AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR lnnvl(B.TARG_PRD_CODE = '*')))
                           UNION ALL
                           ((SELECT A.PRD_CODE          ITEM_1,
                                    A.TARG_PRD_CODE     ITEM_2,
                                    A.SELLER_CODE       ITEM_3,
                                    A.SHARE_CLASS       ITEM_4,
                                    A.C_TARGETSHARETYPE ITEM_5
                             FROM TBFUNDCHANGELIMIT B,
                                  TBFUNDC3EXPTMP1 A
                             WHERE B.PRD_CODE = '*'
                               AND B.SHARE_CLASS = '*'
                               AND A.SELLER_CODE = B.SELLER_CODE
                               AND A.TARG_PRD_CODE = B.TARG_PRD_CODE
                               AND A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS
                               AND (lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                    lnnvl(B.TARG_SHARE_CLASS = '*'))
                               AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SELLER_CODE = '*') OR
                                    lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                               AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR lnnvl(B.SELLER_CODE = '*') OR
                                    lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                               AND (lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                               AND (lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                               AND (lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*'))
                               AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR
                                    lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR lnnvl(B.SELLER_CODE = '*') OR
                                    lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                               AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                    lnnvl(B.TARG_SHARE_CLASS = '*'))
                               AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SELLER_CODE = '*') OR
                                    lnnvl(B.TARG_SHARE_CLASS = '*'))
                               AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SELLER_CODE = '*') OR
                                    lnnvl(B.TARG_PRD_CODE = '*'))
                               AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                    lnnvl(B.TARG_SHARE_CLASS = '*'))
                               AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR lnnvl(B.SELLER_CODE = '*') OR
                                    lnnvl(B.TARG_SHARE_CLASS = '*'))
                               AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR lnnvl(B.SELLER_CODE = '*') OR
                                    lnnvl(B.TARG_PRD_CODE = '*'))
                               AND lnnvl(B.TARG_SHARE_CLASS = '*')
                               AND lnnvl(B.TARG_PRD_CODE = '*')
                               AND lnnvl(B.SELLER_CODE = '*')
                               AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                               AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR lnnvl(B.TARG_PRD_CODE = '*'))
                               AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.TARG_PRD_CODE = '*'))
                               AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR lnnvl(B.SELLER_CODE = '*'))
                               AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR
                                    lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR lnnvl(B.SELLER_CODE = '*') OR
                                    lnnvl(B.TARG_PRD_CODE = '*'))
                               AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SELLER_CODE = '*')))
                            UNION ALL
                            ((SELECT A.PRD_CODE          ITEM_1,
                                     A.TARG_PRD_CODE     ITEM_2,
                                     A.SELLER_CODE       ITEM_3,
                                     A.SHARE_CLASS       ITEM_4,
                                     A.C_TARGETSHARETYPE ITEM_5
                              FROM TBFUNDCHANGELIMIT B,
                                   TBFUNDC3EXPTMP1 A
                              WHERE A.PRD_CODE = B.PRD_CODE
                                AND B.SHARE_CLASS = '*'
                                AND A.SELLER_CODE = B.SELLER_CODE
                                AND A.TARG_PRD_CODE = B.TARG_PRD_CODE
                                AND B.TARG_SHARE_CLASS = '*'
                                AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                     lnnvl(B.TARG_PRD_CODE = '*'))
                                AND (lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*'))
                                AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                                     lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*'))
                                AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*'))
                                AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SELLER_CODE = '*'))
                                AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                     lnnvl(B.TARG_PRD_CODE = '*') OR
                                     lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR lnnvl(B.SELLER_CODE = '*') OR
                                     lnnvl(B.TARG_PRD_CODE = '*'))
                                AND lnnvl(B.TARG_PRD_CODE = '*')
                                AND lnnvl(B.SELLER_CODE = '*')
                                AND (lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                     lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                                     lnnvl(B.TARG_PRD_CODE = '*'))
                                AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                                     lnnvl(B.SELLER_CODE = '*'))
                                AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                                     lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                     lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                AND lnnvl(B.PRD_CODE = '*')
                                AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                     lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                     lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS))
                                AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                                     lnnvl(B.TARG_PRD_CODE = '*') OR
                                     lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                AND (lnnvl(B.TARG_PRD_CODE = '*') OR
                                     lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                                     lnnvl(B.SELLER_CODE = '*') OR
                                     lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR lnnvl(B.SELLER_CODE = '*') OR
                                     lnnvl(B.TARG_PRD_CODE = '*') OR
                                     lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                AND (lnnvl(B.SELLER_CODE = '*') OR
                                     lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                AND (lnnvl(B.PRD_CODE = '*') OR
                                     lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS)))
                             UNION ALL
                             ((SELECT A.PRD_CODE          ITEM_1,
                                      A.TARG_PRD_CODE     ITEM_2,
                                      A.SELLER_CODE       ITEM_3,
                                      A.SHARE_CLASS       ITEM_4,
                                      A.C_TARGETSHARETYPE ITEM_5
                               FROM TBFUNDCHANGELIMIT B,
                                    TBFUNDC3EXPTMP1 A
                               WHERE A.PRD_CODE = B.PRD_CODE
                                 AND A.SHARE_CLASS = B.SHARE_CLASS
                                 AND A.SELLER_CODE = B.SELLER_CODE
                                 AND B.TARG_PRD_CODE = '*'
                                 AND B.TARG_SHARE_CLASS = '*'
                                 AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                      lnnvl(B.SELLER_CODE = '*'))
                                 AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.SELLER_CODE = '*'))
                                 AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SELLER_CODE = '*'))
                                 AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*'))
                                 AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                      lnnvl(B.SELLER_CODE = '*') OR lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE))
                                 AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                      lnnvl(B.SELLER_CODE = '*') OR
                                      lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                 AND lnnvl(B.SELLER_CODE = '*')
                                 AND lnnvl(B.SHARE_CLASS = '*')
                                 AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                      lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE))
                                 AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                      lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                 AND lnnvl(B.PRD_CODE = '*')
                                 AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                      lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE))
                                 AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                      lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                 AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                      lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE))
                                 AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                      lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                 AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                      lnnvl(B.SELLER_CODE = '*') OR
                                      lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR
                                      lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                 AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE))
                                 AND (lnnvl(B.PRD_CODE = '*') OR
                                      lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                 AND (lnnvl(B.SHARE_CLASS = '*') OR
                                      lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                 AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                      lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR
                                      lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                 AND (lnnvl(B.SELLER_CODE = '*') OR
                                      lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                 AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                      lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR
                                      lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                 AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                      lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR
                                      lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                 AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE)))
                              UNION ALL
                              ((SELECT A.PRD_CODE          ITEM_1,
                                       A.TARG_PRD_CODE     ITEM_2,
                                       A.SELLER_CODE       ITEM_3,
                                       A.SHARE_CLASS       ITEM_4,
                                       A.C_TARGETSHARETYPE ITEM_5
                                FROM TBFUNDCHANGELIMIT B,
                                     TBFUNDC3EXPTMP1 A
                                WHERE A.PRD_CODE = B.PRD_CODE
                                  AND A.SHARE_CLASS = B.SHARE_CLASS
                                  AND B.SELLER_CODE = '*'
                                  AND A.TARG_PRD_CODE = B.TARG_PRD_CODE
                                  AND B.TARG_SHARE_CLASS = '*'
                                  AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                       lnnvl(B.TARG_PRD_CODE = '*'))
                                  AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.TARG_PRD_CODE = '*'))
                                  AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*'))
                                  AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                       lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR lnnvl(B.TARG_PRD_CODE = '*'))
                                  AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*'))
                                  AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                       lnnvl(B.TARG_PRD_CODE = '*') OR
                                       lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                  AND lnnvl(B.TARG_PRD_CODE = '*')
                                  AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR
                                       lnnvl(B.TARG_PRD_CODE = '*'))
                                  AND lnnvl(B.SHARE_CLASS = '*')
                                  AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                       lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                  AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR
                                       lnnvl(B.TARG_PRD_CODE = '*'))
                                  AND lnnvl(B.PRD_CODE = '*')
                                  AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                       lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                  AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                       lnnvl(A.SELLER_CODE = B.SELLER_CODE))
                                  AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                       lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                       lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                  AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                       lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                  AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SELLER_CODE = B.SELLER_CODE))
                                  AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR
                                       lnnvl(B.TARG_PRD_CODE = '*') OR
                                       lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                  AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR
                                       lnnvl(B.TARG_PRD_CODE = '*') OR
                                       lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                  AND (lnnvl(B.PRD_CODE = '*') OR
                                       lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                  AND (lnnvl(B.TARG_PRD_CODE = '*') OR
                                       lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                  AND (lnnvl(B.SHARE_CLASS = '*') OR
                                       lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                  AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                       lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR
                                       lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                  AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(A.SELLER_CODE = B.SELLER_CODE))
                                  AND (lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR lnnvl(B.TARG_PRD_CODE = '*')))
                               UNION ALL
                               ((SELECT A.PRD_CODE          ITEM_1,
                                        A.TARG_PRD_CODE     ITEM_2,
                                        A.SELLER_CODE       ITEM_3,
                                        A.SHARE_CLASS       ITEM_4,
                                        A.C_TARGETSHARETYPE ITEM_5
                                 FROM TBFUNDCHANGELIMIT B,
                                      TBFUNDC3EXPTMP1 A
                                 WHERE A.PRD_CODE = B.PRD_CODE
                                   AND A.SHARE_CLASS = B.SHARE_CLASS
                                   AND A.SELLER_CODE = B.SELLER_CODE
                                   AND B.TARG_PRD_CODE = '*'
                                   AND A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS
                                   AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                        lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                   AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                        lnnvl(B.TARG_SHARE_CLASS = '*'))
                                   AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                        lnnvl(B.TARG_SHARE_CLASS = '*'))
                                   AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                        lnnvl(B.TARG_SHARE_CLASS = '*'))
                                   AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                        lnnvl(B.SELLER_CODE = '*') OR
                                        lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR
                                        lnnvl(B.TARG_SHARE_CLASS = '*'))
                                   AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                        lnnvl(B.SELLER_CODE = '*'))
                                   AND (lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                   AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                   AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                        lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR
                                        lnnvl(B.TARG_SHARE_CLASS = '*'))
                                   AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.SELLER_CODE = '*'))
                                   AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                   AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                        lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR
                                        lnnvl(B.TARG_SHARE_CLASS = '*'))
                                   AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SELLER_CODE = '*'))
                                   AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                        lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR
                                        lnnvl(B.TARG_SHARE_CLASS = '*'))
                                   AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*'))
                                   AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                        lnnvl(B.SELLER_CODE = '*') OR
                                        lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE))
                                   AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR
                                        lnnvl(B.TARG_SHARE_CLASS = '*'))
                                   AND lnnvl(B.PRD_CODE = '*')
                                   AND lnnvl(B.SHARE_CLASS = '*')
                                   AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                        lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE))
                                   AND lnnvl(B.SELLER_CODE = '*')
                                   AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                        lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE))
                                   AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                        lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE))
                                   AND (lnnvl(B.SHARE_CLASS = '*') OR
                                        lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR
                                        lnnvl(B.TARG_SHARE_CLASS = '*'))
                                   AND lnnvl(B.TARG_SHARE_CLASS = '*')
                                   AND (lnnvl(B.SELLER_CODE = '*') OR
                                        lnnvl(A.TARG_PRD_CODE = B.TARG_PRD_CODE) OR
                                        lnnvl(B.TARG_SHARE_CLASS = '*')))
                                UNION ALL
                                ((SELECT A.PRD_CODE          ITEM_1,
                                         A.TARG_PRD_CODE     ITEM_2,
                                         A.SELLER_CODE       ITEM_3,
                                         A.SHARE_CLASS       ITEM_4,
                                         A.C_TARGETSHARETYPE ITEM_5
                                  FROM TBFUNDCHANGELIMIT B,
                                       TBFUNDC3EXPTMP1 A
                                  WHERE B.PRD_CODE = '*'
                                    AND A.SHARE_CLASS = B.SHARE_CLASS
                                    AND A.SELLER_CODE = B.SELLER_CODE
                                    AND A.TARG_PRD_CODE = B.TARG_PRD_CODE
                                    AND A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS
                                    AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                         lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                    AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*') OR
                                         lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                         lnnvl(B.TARG_SHARE_CLASS = '*'))
                                    AND (lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                         lnnvl(B.TARG_SHARE_CLASS = '*'))
                                    AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                         lnnvl(B.TARG_SHARE_CLASS = '*'))
                                    AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                         lnnvl(B.TARG_SHARE_CLASS = '*'))
                                    AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                         lnnvl(B.TARG_PRD_CODE = '*'))
                                    AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SELLER_CODE = '*') OR
                                         lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                    AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*') OR
                                         lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                    AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*') OR
                                         lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                    AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*') OR
                                         lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*'))
                                    AND (lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                    AND (lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                    AND (lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*'))
                                    AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                    AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.TARG_PRD_CODE = '*'))
                                    AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.SELLER_CODE = '*'))
                                    AND lnnvl(B.TARG_SHARE_CLASS = '*')
                                    AND lnnvl(B.TARG_PRD_CODE = '*')
                                    AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*') OR
                                         lnnvl(B.TARG_PRD_CODE = '*'))
                                    AND lnnvl(B.SELLER_CODE = '*')
                                    AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SELLER_CODE = '*') OR
                                         lnnvl(B.TARG_PRD_CODE = '*'))
                                    AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*') OR
                                         lnnvl(B.SELLER_CODE = '*'))
                                    AND lnnvl(B.SHARE_CLASS = '*')
                                    AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SHARE_CLASS = '*') OR
                                         lnnvl(B.TARG_SHARE_CLASS = '*'))
                                    AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                         lnnvl(B.TARG_SHARE_CLASS = '*'))
                                    AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.SELLER_CODE = '*') OR
                                         lnnvl(B.TARG_SHARE_CLASS = '*'))
                                    AND (lnnvl(A.PRD_CODE = B.PRD_CODE) OR lnnvl(B.TARG_PRD_CODE = '*')))
                                 UNION ALL
                                 ((SELECT A.PRD_CODE          ITEM_1,
                                          A.TARG_PRD_CODE     ITEM_2,
                                          A.SELLER_CODE       ITEM_3,
                                          A.SHARE_CLASS       ITEM_4,
                                          A.C_TARGETSHARETYPE ITEM_5
                                   FROM TBFUNDCHANGELIMIT B,
                                        TBFUNDC3EXPTMP1 A
                                   WHERE A.PRD_CODE = B.PRD_CODE
                                     AND A.SHARE_CLASS = B.SHARE_CLASS
                                     AND A.SELLER_CODE = B.SELLER_CODE
                                     AND A.TARG_PRD_CODE = B.TARG_PRD_CODE
                                     AND B.TARG_SHARE_CLASS = '*'
                                     AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                          lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*'))
                                     AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                          lnnvl(B.TARG_PRD_CODE = '*'))
                                     AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                          lnnvl(B.TARG_PRD_CODE = '*'))
                                     AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                          lnnvl(B.TARG_PRD_CODE = '*'))
                                     AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                          lnnvl(B.SELLER_CODE = '*'))
                                     AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                          lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                          lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                     AND (lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*'))
                                     AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.TARG_PRD_CODE = '*'))
                                     AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.SELLER_CODE = '*'))
                                     AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                          lnnvl(B.TARG_PRD_CODE = '*') OR
                                          lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                     AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*'))
                                     AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SELLER_CODE = '*'))
                                     AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                          lnnvl(B.TARG_PRD_CODE = '*') OR
                                          lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                     AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*'))
                                     AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                          lnnvl(B.TARG_PRD_CODE = '*') OR
                                          lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                     AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                          lnnvl(B.SELLER_CODE = '*') OR
                                          lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                     AND lnnvl(B.PRD_CODE = '*')
                                     AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                          lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                     AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                          lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                     AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                          lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                     AND (lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                          lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                     AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                          lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                     AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                          lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                     AND lnnvl(B.SHARE_CLASS = '*')
                                     AND lnnvl(B.TARG_PRD_CODE = '*')
                                     AND lnnvl(B.SELLER_CODE = '*')
                                     AND (lnnvl(B.TARG_PRD_CODE = '*') OR
                                          lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS))
                                     AND (lnnvl(B.PRD_CODE = '*') OR
                                          lnnvl(A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS)))
                                  UNION ALL
                                  ((SELECT A.PRD_CODE          ITEM_1,
                                           A.TARG_PRD_CODE     ITEM_2,
                                           A.SELLER_CODE       ITEM_3,
                                           A.SHARE_CLASS       ITEM_4,
                                           A.C_TARGETSHARETYPE ITEM_5
                                    FROM TBFUNDCHANGELIMIT B,
                                         TBFUNDC3EXPTMP1 A
                                    WHERE A.PRD_CODE = B.PRD_CODE
                                      AND A.SHARE_CLASS = B.SHARE_CLASS
                                      AND B.SELLER_CODE = '*'
                                      AND A.TARG_PRD_CODE = B.TARG_PRD_CODE
                                      AND A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS
                                      AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                           lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                      AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                           lnnvl(B.TARG_SHARE_CLASS = '*'))
                                      AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                           lnnvl(B.TARG_SHARE_CLASS = '*'))
                                      AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                           lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR
                                           lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                      AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                           lnnvl(B.TARG_SHARE_CLASS = '*'))
                                      AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                           lnnvl(B.TARG_PRD_CODE = '*'))
                                      AND (lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                      AND (lnnvl(B.SHARE_CLASS = '*') OR
                                           lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR
                                           lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                      AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                      AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.TARG_PRD_CODE = '*'))
                                      AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR
                                           lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                      AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                      AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*'))
                                      AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                           lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR
                                           lnnvl(B.TARG_SHARE_CLASS = '*'))
                                      AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                           lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR
                                           lnnvl(B.TARG_PRD_CODE = '*'))
                                      AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*'))
                                      AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR
                                           lnnvl(B.TARG_SHARE_CLASS = '*'))
                                      AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR
                                           lnnvl(B.TARG_PRD_CODE = '*'))
                                      AND (lnnvl(B.SHARE_CLASS = '*') OR
                                           lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR
                                           lnnvl(B.TARG_PRD_CODE = '*'))
                                      AND lnnvl(B.PRD_CODE = '*')
                                      AND lnnvl(B.TARG_PRD_CODE = '*')
                                      AND lnnvl(B.SHARE_CLASS = '*')
                                      AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                           lnnvl(A.SELLER_CODE = B.SELLER_CODE))
                                      AND (lnnvl(B.SHARE_CLASS = '*') OR
                                           lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR
                                           lnnvl(B.TARG_SHARE_CLASS = '*'))
                                      AND (lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR
                                           lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                      AND lnnvl(B.TARG_SHARE_CLASS = '*')
                                      AND (lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR
                                           lnnvl(B.TARG_PRD_CODE = '*'))
                                      AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SELLER_CODE = B.SELLER_CODE))
                                      AND (lnnvl(A.SELLER_CODE = B.SELLER_CODE) OR
                                           lnnvl(B.TARG_SHARE_CLASS = '*')))
                                   UNION ALL
                                   ((SELECT A.PRD_CODE          ITEM_1,
                                            A.TARG_PRD_CODE     ITEM_2,
                                            A.SELLER_CODE       ITEM_3,
                                            A.SHARE_CLASS       ITEM_4,
                                            A.C_TARGETSHARETYPE ITEM_5
                                     FROM TBFUNDCHANGELIMIT B,
                                          TBFUNDC3EXPTMP1 A
                                     WHERE A.PRD_CODE = B.PRD_CODE
                                       AND B.SHARE_CLASS = '*'
                                       AND A.SELLER_CODE = B.SELLER_CODE
                                       AND A.TARG_PRD_CODE = B.TARG_PRD_CODE
                                       AND A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS
                                       AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                            lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                       AND (lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                            lnnvl(B.TARG_SHARE_CLASS = '*'))
                                       AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                                            lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                            lnnvl(B.TARG_SHARE_CLASS = '*'))
                                       AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                            lnnvl(B.TARG_SHARE_CLASS = '*'))
                                       AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                            lnnvl(B.TARG_SHARE_CLASS = '*'))
                                       AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                            lnnvl(B.TARG_PRD_CODE = '*'))
                                       AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                                            lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                            lnnvl(B.TARG_SHARE_CLASS = '*'))
                                       AND (lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                       AND (lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                       AND (lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*'))
                                       AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                                            lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                       AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                                            lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                       AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                                            lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*'))
                                       AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                       AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*'))
                                       AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SELLER_CODE = '*'))
                                       AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                                            lnnvl(B.TARG_SHARE_CLASS = '*'))
                                       AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                                            lnnvl(B.TARG_PRD_CODE = '*'))
                                       AND lnnvl(B.TARG_PRD_CODE = '*')
                                       AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                                            lnnvl(B.SELLER_CODE = '*'))
                                       AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                                            lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*'))
                                       AND lnnvl(B.SELLER_CODE = '*')
                                       AND lnnvl(B.PRD_CODE = '*')
                                       AND lnnvl(B.TARG_SHARE_CLASS = '*')
                                       AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                                            lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                       AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                                            lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                       AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                                            lnnvl(B.TARG_PRD_CODE = '*'))
                                       AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(A.SHARE_CLASS = B.SHARE_CLASS))
                                       AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                                            lnnvl(B.TARG_SHARE_CLASS = '*'))
                                       AND (lnnvl(A.SHARE_CLASS = B.SHARE_CLASS) OR
                                            lnnvl(B.SELLER_CODE = '*')))
                                    UNION ALL
                                    (SELECT A.PRD_CODE          ITEM_1,
                                            A.TARG_PRD_CODE     ITEM_2,
                                            A.SELLER_CODE       ITEM_3,
                                            A.SHARE_CLASS       ITEM_4,
                                            A.C_TARGETSHARETYPE ITEM_5
                                     FROM TBFUNDCHANGELIMIT B,
                                          TBFUNDC3EXPTMP1 A
                                     WHERE A.PRD_CODE = B.PRD_CODE
                                       AND A.SHARE_CLASS = B.SHARE_CLASS
                                       AND A.SELLER_CODE = B.SELLER_CODE
                                       AND A.TARG_PRD_CODE = B.TARG_PRD_CODE
                                       AND A.C_TARGETSHARETYPE = B.TARG_SHARE_CLASS
                                       AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                            lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                            lnnvl(B.TARG_SHARE_CLASS = '*'))
                                       AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                            lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                       AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                            lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                       AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                            lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                       AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                            lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                       AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                            lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*'))
                                       AND (lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                            lnnvl(B.TARG_SHARE_CLASS = '*'))
                                       AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                            lnnvl(B.TARG_SHARE_CLASS = '*'))
                                       AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                            lnnvl(B.TARG_SHARE_CLASS = '*'))
                                       AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                            lnnvl(B.TARG_PRD_CODE = '*'))
                                       AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*') OR
                                            lnnvl(B.TARG_SHARE_CLASS = '*'))
                                       AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                            lnnvl(B.TARG_SHARE_CLASS = '*'))
                                       AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SELLER_CODE = '*') OR
                                            lnnvl(B.TARG_PRD_CODE = '*'))
                                       AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                            lnnvl(B.TARG_SHARE_CLASS = '*'))
                                       AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                            lnnvl(B.TARG_PRD_CODE = '*'))
                                       AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*') OR
                                            lnnvl(B.SELLER_CODE = '*'))
                                       AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                       AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*'))
                                       AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.TARG_PRD_CODE = '*'))
                                       AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SELLER_CODE = '*'))
                                       AND (lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_PRD_CODE = '*'))
                                       AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.SELLER_CODE = '*'))
                                       AND (lnnvl(B.PRD_CODE = '*') OR lnnvl(B.SHARE_CLASS = '*'))
                                       AND (lnnvl(B.SHARE_CLASS = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                       AND (lnnvl(B.TARG_PRD_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                       AND (lnnvl(B.SELLER_CODE = '*') OR lnnvl(B.TARG_SHARE_CLASS = '*'))
                                       AND lnnvl(B.TARG_PRD_CODE = '*')
                                       AND lnnvl(B.PRD_CODE = '*')
                                       AND lnnvl(B.TARG_SHARE_CLASS = '*')
                                       AND lnnvl(B.SELLER_CODE = '*')
                                       AND lnnvl(B.SHARE_CLASS = '*'))))))))))))))))))))))))))))))))) vm_tmp;

26秒出結果

執行計劃預期與Oracle相同,前提SQL等價



來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29990276/viewspace-2899686/,如需轉載,請註明出處,否則將追究法律責任。

相關文章