SQL processing in Oracle to System.currenttimemillis

Source: Internet
Author: User

There are times when the requirements of the system are recorded in milliseconds (millisecond), and we are going to write the values in db, but if we want to use SQL to do time-range searches, there are a few things to do with the following
( Systemdate linked Fields bit holds system.currenttimemillis () value obtained)

 

--Find mytable systemdate bit in 2006/11/28 14:00:00 ~ 14:10:00 Information
Select * from myTable where
Systemdate >= (to_date (' 20061128 14:00:00 ', ' YYYYMMDD hh24:mi : SS ')-To_date (' 19700101 8:00:00 ', ' YYYYMMDD hh24:mi:ss ')) *1000*60*60*24
and Systemdate <= (to_date (' 20061128 14:10:00 ', ' YYYYMMDD hh24:mi:ss ')-to_date (' 19700101 8:00:00 ', ' YYYYMMDD hh24:mi:ss ')) *1000*60*60*24

 

--Find out the time of the lowest date in the MyTable data table Select To_date ( ' 19700101 8:00:00 ' ,  ' YYYYMMDD hh24:mi:ss ' ) + ((select min (systemdate) from myTable)/1000/60/60/24) the from dual 

is processed in Oracle with SQL to System.currenttimemillis

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.