如何在 Oracle SQL WHERE 中表达“现在减去 30 分钟”,以便我可以将其与存储的时间戳进行比较?
解决方案是
dateadd()
函数或
systimestamp - INTERVAL '30' minute(1)
where yourTimestamp >= sysdate - 1/48
说明
sysdate - 1 (subtract 1 day)
sysdate - 1/24 (subtract 1 hour)
sysdate - 0.5/24 (subtract 30 minutes)
sysdate - 0.5 * 2/ 24 * 2 = sysdate - 1/48.