Oracle retrieves data for a certain period of time

Source: Internet
Author: User

Oracle retrieves data for a certain period of time:

Sysdate + 1 is plus a day, sysdate +/-(1/48) is plus/minus half an hour

Select count (*) from table_name where table_name.date between to_char (sysdate-1/48, 'yyyymmdd HH: Mi') and sysdate

Date indicates the field name to be counted.

Table_name indicates the table name.

To_char is a date function to_char (sysdate, 'yyyymmdd HH: mi ') to intercept to minutes, and the corresponding to_char (sysdate, 'yyyymmdd hh') to intercept to hours. To_char (sysdate, 'yyyymm') is the month to which the object is intercepted,

Related Article

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.