oracle中的CURRENT_TIMESTAMP和SYSDATE不同 [英] Different CURRENT_TIMESTAMP and SYSDATE in oracle

查看:1080
本文介绍了oracle中的CURRENT_TIMESTAMP和SYSDATE不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在oracle 10g中执行此SQL之后:

After executing this SQL in oracle 10g:

SELECT SYSDATE, CURRENT_TIMESTAMP  FROM DUAL

我收到以下奇怪的输出:

I receive this strange output:

造成时间差异的原因是什么? 服务器时间等于SYSDATE值

What is cause of the difference in time? The server time is equal of SYSDATE value

推荐答案

CURRENT_DATE CURRENT_TIMESTAMP 返回会话时区.

CURRENT_DATE and CURRENT_TIMESTAMP return the current date and time in the session time zone.

SYSDATE

SYSDATE and SYSTIMESTAMP return the system date and time - that is, of the system on which the database resides.

如果您的客户端会话不在数据库所在服务器所在的时区(或者说通过NLS设置不在同一时区),则混合使用SYS*CURRENT_*函数将返回不同的值.它们都是正确的,它们只是代表不同的事物.看来您的服务器位于(或认为是)+4:00时区,而客户端会话位于+4:30时区.

If your client session isn't in the same timezone as the server the database is on (or says it isn't anyway, via your NLS settings), mixing the SYS* and CURRENT_* functions will return different values. They are all correct, they just represent different things. It looks like your server is (or thinks it is) in a +4:00 timezone, while your client session is in a +4:30 timezone.

如果时钟不同步,您可能还会在时间上看到细微的差别,这似乎不是问题所在.

You might also see small differences in the time if the clocks aren't synchronised, which doesn't seem to be an issue here.

这篇关于oracle中的CURRENT_TIMESTAMP和SYSDATE不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆