Definition in View&Database

Here is the definition in Application Designer:

SELECT a.SETID
 , a.PROD_GRP_TYPE
 , a.PRODUCT_GROUP
 , a.DESCR
 , a.GLOBAL_FLAG
 , a.eff_status
  FROM %Table(PROD_GROUP_TBL) a
 WHERE (%EffdtCheck(PROD_GROUP_TBL b, a, %CurrentdateIn)
    OR a.EFFDT > %CurrentDateIn) 
   AND MARKET = 'GBL'

When you view it in database, it is translated into the sql below:

SELECT a.setid, a.prod_grp_type, a.product_group, a.descr, a.global_flag
     FROM ps_prod_group_tbl a
    WHERE (   a.effdt =
                 (SELECT MAX (effdt)
                    FROM ps_prod_group_tbl b
                   WHERE b.setid = a.setid
                     AND b.prod_grp_type = a.prod_grp_type
                     AND b.product_group = a.product_group
                     AND b.effdt <=
                            TO_DATE (TO_CHAR (SYSDATE, 'YYYY-MM-DD'),
                                     'YYYY-MM-DD'
                                    ))
           OR a.effdt >
                       TO_DATE (TO_CHAR (SYSDATE, 'YYYY-MM-DD'), 'YYYY-MM-DD')
          )
      AND market = 'GBL';

转载于:https://www.cnblogs.com/GoDevil/archive/2009/01/07/1371035.html

你可能感兴趣的:(Definition in View&Database)