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 7617991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:17:02+00:00 2026-05-31T03:17:02+00:00

The query below does not work missing right parenthesis but you know what I

  • 0

The query below does not work

missing right parenthesis

but you know what I need to get, so how I can get it to work?
how should I write it!

SELECT sysdate,
       (sysdate + interval (to_char(sysdate, 'YYYY') - 2011) YEAR) as tt
FROM dual;

I was thinking of this solution

SELECT sysdate,
       add_months(sysdate,12*(to_char(sysdate, 'YYYY') - 2011))
FROM dual;

is it a correct approach?

Thanks

  • 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-31T03:17:03+00:00Added an answer on May 31, 2026 at 3:17 am

    This should get you to what you are looking for:

    SELECT
        sysdate,
        (sysdate + TO_YMINTERVAL((to_char(sysdate, 'YYYY') - 2011)||'-0')) as tt
    FROM dual; 
    

    Note the appending of the “-0” is necessary, since there is no Year interval, it has years and months (the “-0” indicates 0 months).

    It should also be noted that this will cause problems on leap day, since Feb 29 doesn’t exist next year.

    I would solve this problem by converting your years to months (multiply by 12) and using add_months:

    SELECT
        sysdate,
        add_months(sysdate, (to_char(sysdate, 'YYYY') - 2011)*12) as tt
    FROM dual;
    

    Which on leap day will return 2/28/2013 for tt.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the below query which does not work. What am I doing wrong?
Why does the MySQL query below give error 1066 (Not unique table/alias: 'customer') ?
Why the two query below return duplicate member_id and not the third? I need
I have a query that works in phpmyadmin however does not work in my
Not sure how to do this. The code below does not work. From the
What does the below query explain? SELECT * FROM `jos_menu` WHERE (id = 69
Why does the following query raise the error below for a row with a
My native query below is working fine oracle sqlplus. But through JPA native query,
I get the following error in the query below: #1064 - You have an
I have this problem. Session does not work when I use with $_POST. If

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.