2022-12-12

[Oracle]How to Query Flexfield

SELECT *
  FROM (SELECT 'GLOBAL' TYPE,
               FDFV.APPLICATION_ID,
               FPV.APPLICATION_SHORT_NAME,
               FDFV.APPLICATION_TABLE_NAME,
               FDFV.CONTEXT_COLUMN_NAME,
               FDFV.TITLE,
               FDFC.DESCRIPTIVE_FLEX_CONTEXT_CODE,
               FDFU.APPLICATION_COLUMN_NAME,
               FDFU.END_USER_COLUMN_NAME,
               FDFU.ENABLED_FLAG
          FROM FND_DESCRIPTIVE_FLEXS_VL    FDFV,
               FND_DESCR_FLEX_CONTEXTS_VL  FDFC,
               FND_DESCR_FLEX_COL_USAGE_VL FDFU,
               FND_APPLICATION_VL          FPV
         WHERE 1 = 1
           AND FDFV.APPLICATION_ID = FDFC.APPLICATION_ID
           AND FDFV.DESCRIPTIVE_FLEXFIELD_NAME =
               FDFC.DESCRIPTIVE_FLEXFIELD_NAME
           AND FDFC.DESCRIPTIVE_FLEXFIELD_NAME =
               FDFU.DESCRIPTIVE_FLEXFIELD_NAME
              --AND FDFC.DESCRIPTIVE_FLEX_CONTEXT_CODE = FDFU.DESCRIPTIVE_FLEX_CONTEXT_CODE
           AND UPPER(FDFC.DESCRIPTIVE_FLEX_CONTEXT_CODE) =
               'GLOBAL DATA ELEMENTS'
           AND FDFV.APPLICATION_ID = FPV.APPLICATION_ID
        UNION ALL
        SELECT 'OTHERS' TYPE,
               FDFV.APPLICATION_ID,
               FPV.APPLICATION_SHORT_NAME,
               FDFV.APPLICATION_TABLE_NAME,
               FDFV.CONTEXT_COLUMN_NAME,
               FDFV.TITLE,
               FDFC.DESCRIPTIVE_FLEX_CONTEXT_CODE,
               FDFU.APPLICATION_COLUMN_NAME,
               FDFU.END_USER_COLUMN_NAME,
               FDFU.ENABLED_FLAG
          FROM FND_DESCRIPTIVE_FLEXS_VL    FDFV,
               FND_DESCR_FLEX_CONTEXTS_VL  FDFC,
               FND_DESCR_FLEX_COL_USAGE_VL FDFU,
               FND_APPLICATION_VL          FPV
         WHERE 1 = 1
           AND FDFV.APPLICATION_ID = FDFC.APPLICATION_ID
           AND FDFV.DESCRIPTIVE_FLEXFIELD_NAME =
               FDFC.DESCRIPTIVE_FLEXFIELD_NAME
           AND FDFC.DESCRIPTIVE_FLEXFIELD_NAME =
               FDFU.DESCRIPTIVE_FLEXFIELD_NAME
           AND FDFC.DESCRIPTIVE_FLEX_CONTEXT_CODE =
               FDFU.DESCRIPTIVE_FLEX_CONTEXT_CODE
           AND FDFV.APPLICATION_ID = FPV.APPLICATION_ID)
 WHERE 1 = 1
   AND APPLICATION_TABLE_NAME = 'WIP_DISCRETE_JOBS'

沒有留言:

張貼留言