The database reports an ORA-01839 Error

Source: Internet
Author: User

The database reports an ORA-01839 Error

The ZCGL database reports that the date of the month specified by the ORA-01839 is invalid when running the SQL statement

The detailed SQL statement is simplified as follows:

Select *

From table_name

Where to_date (a. yc_date, 'yyyy-mm-dd')-sysdate> 1

[Cause of problem] The ORA-01839 indicates that the date of the result set of z_yc_date does not meet the corresponding date standard.

Select to_date ('2014/1/31', 'yyyy/mm/dd') from dual;

Because February No 31, so it will be reported ORA-01839 error;

[Solution] There are two solutions to this error:

1. Find out the date that does not conform to the specification in the source data (the result set has been exported but no obvious error has been found );

2. Rewrite the corresponding SQL statement as follows:

Select * from table_name

Where ya. c_date> = to_char (sysdate, 'yyyy-mm-dd') # compare data by using the struct

[Summary] the above problems can be avoided during table creation. We recommend that you store the columns of time and date. We recommend that you set the column type to date when creating the table, it is of great benefit to subsequent management and performance;

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.