Here is my SQL :
SELECT F9_OA008_DT||'|',
DED2(PX_OA008_PAN,'a')||'|',
F9_OA008_MCC||'|',
FX_OA008_MERC_NAME||FX_OA008_MERC_FILLER1||FX_OA008_MERC_CTY||FX_OA008_MERC_FILLER2||FX_OA008_MERC_ST_CNTRY||'|',
F9_OA008_AMT_REQ
FROM OA008
WHERE F9_OA008_MCC=5542 AND F9_OA008_DT >= 20120501
UNION
SELECT F9_IB006_DT||'|',
DED2(PX_IB006_PAN,'a')||'|',
F9_IB006_MCC||'|',
FX_IB006_CRD_ACCPT_NAL||'|',
F9_IB006_AMT_REQ
FROM IB006
WHERE F9_IB006_MCC=5542 AND F9_IB006_DT >= 20120501
;
When I added in ORDER BY F9_OA008_DT for the 1st SQL and ORDER BY F9_IB006_DT for the 2nd sql , it will hit error. Why ? The error msg is: ORA-00923: FROM keyword not found where expected.