The interchange ____oracle of long and date in Oracle

Source: Internet
Author: User
Tags numeric value oracle database

If the Oracle database Time field is set to the number type, the query time column is presented as a numeric value, such as the "1241450728000" style, is not readable, and the "2009/5/4 15:25:28" style update time prompts " Ora-01722:invalid number ", cannot be updated.

At this point, we need to format this, examples are as follows:


--date Long Example
select Sysdate (sysdate-to_date (' 1970-01-01 ', ' yyyy-mm-dd ')) * 24*60*60*1000 as integral format from dual;
 
--long to date
select  to_date (' 1970-01-0100:00:00 ', ' yyyy-mm-dd hh24:mi:ss ') + 1241450728000/1000/24/60/60 from  dual;


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.