[Oracle] 比對2批資料語法

利用差集作比對

WITH A AS
 ( --這裡撈正式
  SELECT * FROM MON00@正式 WHERE YYMM = '201802' --
  ),
B AS
 ( --這裡撈測試
  SELECT * FROM MON00 WHERE YYMM = '201802' --
  )
SELECT '正式' 環境, AA.* FROM (SELECT * FROM A MINUS SELECT * FROM B) AA
UNION ALL
SELECT '測試', AA.* FROM (SELECT * FROM B MINUS SELECT * FROM A) AA;

 

Taiwan is a country. 臺灣是我的國家