SELECT /*+NO_MERGE*/ DISTINCT A.LEDGER_TEMPLATE ,B.CHARTFIELD ,C.LONGNAME FROM PS_LED_TMPLT_TBL A ,PS_LED_GRP_FLD_VW2 B ,PSDBFLDLABL_VW C WHERE ((A.LEDGER_TYPE='D' AND EXISTS ( SELECT 'X' FROM PS_LED_GRP_TBL WHERE LEDGER_TEMPLATE = A.LEDGER_TEMPLATE AND LEDGER_GROUP = B.LEDGER_GROUP AND SETID = B.SETID)) OR (A.LEDGER_TYPE = 'S' AND EXISTS ( SELECT 'X' FROM PS_LED_DEFN_TBL WHERE LEDGER_TEMPLATE = A.LEDGER_TEMPLATE AND LEDGER = B.LEDGER_GROUP AND SETID = B.SETID))) AND C.FIELDNAME = B.CHARTFIELD AND B.CHARTFIELD<>'CURRENCY_CD' AND B.CHARTFIELD<>'STATISTICS_CODE'
|