q66262 发表于 2018-9-14 13:14:44

oracle 查询一段时间之前的数据

  select* from txt001_menu
  as of timestamp (systimestamp - interval '300' minute)
  wheremenuid = '060201' --查找txt001_menu表中300分钟之前的数据
  
  >>>>select * from txt001_menu as of timestamp (systimestamp - interval'600' second) where menuid = '060201' --查找txt001_menu表中600秒之前的数据
  
  >>>>select * from txt001_menu as of timestamp (systimestamp - interval '3'hour)
  wheremenuid = '060201' --查找txt001_menu表中3小时之前的数据
  
  >>>>select * from txt001_menu as of timestamp (systimestamp - interval '1'day)
  wheremenuid = '060201' --查找txt001_menu表中1天之前的数据
  ——————————————————————————————————————————————
  timestamp(ags) 方法
  interval(时间间隔)类型用来存储两个时间戳之间的时间间隔
时间间隔类型interval请看我的另一篇博文:


页: [1]
查看完整版本: oracle 查询一段时间之前的数据