1. 程式人生 > >oracle查詢某表歷史記錄

oracle查詢某表歷史記錄

查詢歷史資料關鍵字TIMESTAMP

SELECT * FROM ROLE_RESOURCE AS OF TIMESTAMP TO_TIMESTAMP('2018-10-11 11:10:00', 'yyyy-mm-dd hh24:mi:ss') WHERE role_id='25' ORDER BY RESOURCE_ID,

做資料減法 關鍵字 minus

SELECT ROLE_id,RESOURCE_id
  FROM ROLE_RESOURCE AS OF TIMESTAMP TO_TIMESTAMP('2018-10-14 12:10:00', 'yyyy-mm-dd hh24:mi:ss')
  WHERE role_id='1100'
minus
SELECT ROLE_id,RESOURCE_id
  FROM ROLE_RESOURCE AS OF TIMESTAMP TO_TIMESTAMP('2018-10-11 7:10:00', 'yyyy-mm-dd hh24:mi:ss')
  WHERE role_id='1100'