A method for accurately detecting a day's data through SQL _oracle

Source: Internet
Author: User

Objective

Data query, whether in the Web site or in the system are very common, the following article is to introduce to you through the SQL accurate detection of the day data, the following to learn.

The original Oracle database is defined as a day from 12 o'clock in the morning to the next day before 12 o'clock and cannot be equal to the next day of 12 o'clock in the morning.

For example, to find out the data for the 2014-10-1 day

SQL is

Select To_char (bizdate, ' yyyy-mm-dd HH24:mi:ss '), id from Table_person where bizdate >=to_date (' 2014-10-01 00:00:00 '), ' Yyyy-mm-dd HH24:mi:ss ') and bizdate <to_date (' 2014-10-02 00:00:00 ', ' yyyy-mm-dd HH24:mi:ss ')  

Use the Java code to directly use the Calender date class to move the date one day

Java Sample Code

Calendar cal=calendar.getinstance (); 
          Cal.settime (Model.getrepdate ()); 
          Cal.add (calendar.date, 1);//Add one day  

Summary

The above is the entire content of this article, I hope the content of this article for everyone's study or work can bring certain help, if you have questions you can message exchange

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.