2015 first Blog, Oracle time period query, to_date and To_char use comparison

Source: Internet
Author: User
Write in front:
Time period query, when using To_date, including the start date, does not include the end date;
You can include a start date or an end date when using To_char. Specific effects


1. To_date use, no query to end date.



2. To_char use, query to end date.



3.sql Contrast

--includes start date, excluding end date Select*fromsyst_logwhere (Operate_time > To_date (' 2015-02-03 ', ' yyyy-mm-dd ') and Operate_time < To_date (' 2015-02-06 ', ' yyyy-mm-dd ')) ORDER byoperate_time desc;--includes the start date, also including the end date Select*fromsyst_logwhereto_char ( Operate_time, ' yyyy-mm-dd ') >= ' 2015-02-03 ' and To_char (operate_time, ' yyyy-mm-dd ') <= ' 2015-02-06 ' ORDER Byoperate_time DESC;


2015 first Blog, Oracle time period query, to_date and To_char use comparison

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.