Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6386349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:00:48+00:00 2026-05-25T03:00:48+00:00

This query works withour errors select add_months(date ‘2011-01-31’, 1) from dual; , while this

  • 0

This query works withour errors

select add_months(date '2011-01-31', 1) from dual;

, while this one:

select date '2011-01-31' + interval '1' month from dual;

returns

ORA-01839: date not valid for month specified

So is there any safe way to add interval using INTERVAL literal?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T03:00:49+00:00Added an answer on May 25, 2026 at 3:00 am

    This follows ANSI-specified behavior1 of adding INTERVALs to dates. This is also documented here:

    When interval calculations return a datetime value, the result must be an actual datetime value or the database returns an error. For example, the next two statements return errors:

    SELECT TO_DATE('31-AUG-2004','DD-MON-YYYY') + TO_YMINTERVAL('0-1') FROM DUAL;

    SELECT TO_DATE('29-FEB-2004','DD-MON-YYYY') + TO_YMINTERVAL('1-0') FROM DUAL;

    The function ADD_MONTHS on the other hand will just give you the last day of the month if the resulting month has less days – and I believe this function was created to address this issue.


    1 http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt

    b) Arithmetic is performed so as to maintain the integrity of
      the datetime data type that is the result of the <datetime
      value expression>. This may involve carry from or to the
      immediately next more significant <datetime field>. If the
      data type of the <datetime value expression> is TIME, then
      arithmetic on the HOUR <datetime field> is undertaken modulo
      24. If the <interval value expression> or <interval term> is
      a year-month interval, then the DAY field of the result is
      the same as the DAY field of the <datetime term> or <datetime
      value expression>.
    
    c) If, after the preceding step, any <datetime field> of the
      result is outside the permissible range of values for the
      field or the result is invalid based on the natural rules for
      dates and times, then an exception condition is raised: data
      exception-datetime field overflow.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This query works: item = db.GqlQuery(SELECT * FROM Item WHERE CSIN = 13)[0] although
So I have this query that works perfectly: SELECT users.*, GROUP_CONCAT(categories.category_name) AS categories FROM
I'm having this Mysql query, It works: SELECT nom ,prenom ,(SELECT GROUP_CONCAT(category_en) FROM (SELECT
This query works great: var pageObject = (from op in db.ObjectPermissions join pg in
This has to be obtained from a remote machine. The following query works not
I have this query: SELECT `manufacturers`.*, `languages`.*, COUNT(`products`.`id`) AS productcount FROM (`manufacturers`) WHERE `manufacturers`.`flushed`
Here is a simple query: SELECT COUNT(*) FROM m_bug_t WHERE date_submitted BETWEEN TO_DATE('2011-08-22','yyyy-mm-dd') AND
I have problems running a dynamic LIKE statement in my project: this query works
I know this particular query works, as I tested it with unprepared, procedural methods.
I have this query which works correctly in MySQL. More background on it here

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.