将此 SQL Server 查询转换为 Oracle
我在 SQL Server 查询中有以下内容,我必须将其转换为 Oracle sp
DATEADD(dd, 0, DATEDIFF(dd, 0, DATEADD(ss, -L_LAST_TIME, TR.TR_DATETIME))) AS TRDATE,
本质上,您从 TR_DATETIME
中减去 L_LAST_TIME
秒,然后截断时间部分并仅保留日期部分。
I have the following in a SQL Server query which I have to convert to Oracle sp
DATEADD(dd, 0, DATEDIFF(dd, 0, DATEADD(ss, -L_LAST_TIME, TR.TR_DATETIME))) AS TRDATE,
Essentially you subtract L_LAST_TIME
seconds from TR_DATETIME
and then truncate the time part and keep only the date part.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以划分间隔:
或
You can divide intervals:
or
我们可以在 Oracle 中对日期进行算术运算。
将
l_last_time
除以 86400 会将秒数变为一天的一小部分。从tr_time
列中减去它会得到一个新的、更早的日期。截断日期会删除时间部分。We can do arithmetic with dates in Oracle.
Dividing
l_last_time
by 86400 turns a number of seconds into a fraction of day. Subtracing it from thetr_time
column gives you a new, earlier date. Truncating a date removes the time component.