请帮助查找SQL中两个时间戳之间的差异
我试着用
Select (cast(sysdate as timestamp) - cast(sysdate-2 as timestamp)) diff from dual;我收到‘ORA-00911:无效字符’错误
发布于 2021-06-17 13:05:19
如果你想要一些看起来简单一点的东西,试试这个来查找过去1分钟内发生的表中的事件:
有了这个条目,你可以摆弄十进制值,直到你得到你想要的分钟值。就sysdate有效数字而言,值.0007恰好是1分钟。您可以使用该值的倍数来获得您想要的任何其他值:
select (sysdate - (sysdate - .0007)) * 1440 from dual;结果为1(分钟)
那么检查它就很简单了。
select * from my_table where (sysdate - transdate) < .00071;https://stackoverflow.com/questions/68013161
复制相似问题