当前时间为APEX_UTIL.GET_SINCE怎么会告诉我时间戳记是将来的6分钟?在此之前,它按预期工作并返回“现在”,但有一小段时间便说当前日期在将来。
底层Linux系统的系统时间具有正确的时间(最多一毫秒),并且该语句返回的sysdate也是正确的当前时间,因此我希望Oracle函数使用其他地方的错误引用吗?
答案 0 :(得分:4)
据我所知,不是
告诉时间戳记是将来的6分钟
但过去是。
第一个调用似乎设置了“标记”,随后的调用返回自此以来已经经过了多少时间。
第一个电话是19:39:11,现在是“现在”:
SQL> select to_char(sysdate, 'hh24:mi:ss') sysd, apex_util.get_since(sysdate) result from dual;
SYSD RESULT
-------- --------------------------------------------------
19:39:11 Now
我现在只是按键盘上的UP键并按ENTER键:
SQL> select to_char(sysdate, 'hh24:mi:ss') sysd, apex_util.get_since(sysdate) result from dual;
SYSD RESULT
-------- --------------------------------------------------
19:39:12 1 seconds from now
SQL> select to_char(sysdate, 'hh24:mi:ss') sysd, apex_util.get_since(sysdate) result from dual;
SYSD RESULT
-------- --------------------------------------------------
19:39:13 2 seconds from now
SQL> select to_char(sysdate, 'hh24:mi:ss') sysd, apex_util.get_since(sysdate) result from dual;
SYSD RESULT
-------- --------------------------------------------------
19:39:14 3 seconds from now
SQL> select to_char(sysdate, 'hh24:mi:ss') sysd, apex_util.get_since(sysdate) result from dual;
SYSD RESULT
-------- --------------------------------------------------
19:39:15 4 seconds from now
SQL> select to_char(sysdate, 'hh24:mi:ss') sysd, apex_util.get_since(sysdate) result from dual;
SYSD RESULT
-------- --------------------------------------------------
19:39:16 5 seconds from now
SQL>
输入上述消息后(我是说,回答问题),我再次调用它;它说距商标已经三分钟了:
SQL> select to_char(sysdate, 'hh24:mi:ss') sysd, apex_util.get_since(sysdate) result from dual;
SYSD RESULT
-------- --------------------------------------------------
19:41:41 3 minutes from now
SQL>
为了重置它,我退出SQL * Plus并重新开始:
SQL> exit
Disconnected from Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
c:\Temp>sqlplus scott/tiger
SQL*Plus: Release 11.2.0.2.0 Production on Pet Lis 18 19:42:31 2019
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
SQL> col result format a50
新标记设置为19:42:36:
SQL> select to_char(sysdate, 'hh24:mi:ss') sysd, apex_util.get_since(sysdate) result from dual;
SYSD RESULT
-------- --------------------------------------------------
19:42:36 Now
SQL> select to_char(sysdate, 'hh24:mi:ss') sysd, apex_util.get_since(sysdate) result from dual;
SYSD RESULT
-------- --------------------------------------------------
19:42:38 2 seconds from now
SQL> select to_char(sysdate, 'hh24:mi:ss') sysd, apex_util.get_since(sysdate) result from dual;
SYSD RESULT
-------- --------------------------------------------------
19:42:39 3 seconds from now
SQL>