关于sysdate与current_date
sysdate:返回数据库服务器所在操作系统的当前时间。值的类型是date,返回的格式取决于nls_date_format初始
化参数.
current_date:返回会话所在时区的当前时间。
正常情况下他们应该是一致的。
SQL> select to_char(sysdate,'yyyy-mm-dd,hh:mm:ss')as systime,
2 to_char(current_date,'yyyy-mm-dd,hh:mm:ss') as current_time
3 from dual;
SYSTIME CURRENT_TIME
------------------- -------------------
2012-02-27,10:02:26 2012-02-27,10:02:26
修改会话的时区为东九区,也就是日本所在的时区。中国的时区是东8区。
SQL> alter session set time_zone='9:0';
Session altered.
SQL> select to_char(sysdate,'yyyy-mm-dd,hh:mm:ss')as systime,
2 to_char(current_date,'yyyy-mm-dd,hh:mm:ss') as current_time
3 from dual;
SYSTIME CURRENT_TIME
------------------- -------------------
2012-02-27,11:02:43 2012-02-28,12:02:43
现在sysdate与current_time的时间就不一样了。current_time比sysdate快一个小时。因为时间是
东加西减嘛。所有如果你的数据库服务器在美国,你在中国做远程维护数据库的话,那么sysdate与
current_time的时间就不一样了。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26110315/viewspace-717262/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/26110315/viewspace-717262/