The difference between current_date and sysdate

Source: Internet
Author: User

Current_date and Sysdate in Oracle display the current system time, the results are basically the same, but there are three different points:

1. Current_date returns the current session time, and Sysdate returns the server time.

2.current_date sometimes a second faster than Sysdate, which may be the result of rounding.

3. If you modify the current session of the time zone, such as the China's time zone is East eight, modified to East nine, then current_date show the time of East Nine, according to the principle of East plus west, current_date should be faster than sysdate an hour.

alter session set nls_date_format= ' Yyyy-mm-dd hh24:mi:ss ';

20:01:26 sql> Select current_date,sysdate from dual;

Current_date sysdate
------------------- -------------------
2009-03-10 20:01:37 2009-03-10 20:01:37

elapsed:00:00:00.00
20:01:37 sql> Select current_date,sysdate from dual;

Current_date sysdate
------------------- -------------------
2009-03-10 20:01:43 2009-03-10 20:01:43

elapsed:00:00:00.01
20:01:43 sql> Select current_date,sysdate from dual;

Current_date sysdate
------------------- -------------------
2009-03-10 20:01:44 2009-03-10 20:01:43

Note that current_date and sysdate are almost a second.

Modify the current session time zone to East area nine

Alter session set Time_zone= ' +09:00 '

20:04:19 sql> Select Current_date,sysdate from dual

Current_date sysdate
------------------- -------------------
2009-03-10 21:04:22 2009-03-10 20:04:22

Http://hi.baidu.com/sunfengwei/item/ffa059dd543afcf593a974c1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.