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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T13:13:20+00:00 2026-06-08T13:13:20+00:00

I am getting ORA-00905: missing keyword error when trying to run the following query

  • 0

I am getting ORA-00905: missing keyword error when trying to run the following query in Oracle:

select distinct MONTH_ID
from    DSS_MAIN.DIM_TIME a1
where   Case When TO_CHAR(SYSDATE,'MM') < 3
Then TO_CHAR(a1.MONTH_START_DATE,'YYYYMM') Between (TO_CHAR(SYSDATE,'YYYY')-1)||'03' And TO_CHAR(SYSDATE,'YYYYMM')
Else TO_CHAR(a1.MONTH_START_DATE,'YYYYMM') Between TO_CHAR(SYSDATE,'YYYY')||'03' And TO_CHAR(SYSDATE,'YYYYMM')
End;

The individual Between clauses work fine, so I am assuming there is something wrong with the Case syntax.

Any ideas?

  • 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-06-08T13:13:22+00:00Added an answer on June 8, 2026 at 1:13 pm

    Try this:

    SELECT DISTINCT MONTH_ID
      FROM DSS_MAIN.DIM_TIME A1
     WHERE TO_CHAR(A1.MONTH_START_DATE, 'YYYYMM') 
                BETWEEN CASE
                            WHEN TO_CHAR(SYSDATE, 'MM') < '03' THEN
                                (TO_NUMBER(TO_CHAR(SYSDATE, 'YYYY')) - 1) || '03'
                            ELSE
                                TO_CHAR(SYSDATE, 'YYYY') || '03'
                        END
                    AND  TO_CHAR(SYSDATE, 'YYYYMM')
    

    Case returns a value for further use, it will not be useful in the way you used it.

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

Sidebar

Related Questions

Getting ORA-00918: column ambiguously defined: running this SQL: SELECT * FROM (SELECT DISTINCT(coaches.id), people.*,
hi i am using oracle db. getting in the following statements.ORA-00936: missing expression string
I am getting ORA-00979 with the following query: SELECT cr.review_sk, cr.cs_sk, cr.full_name, tolist(to_char(cf.fact_date, 'mm/dd/yyyy'))
I'm having trouble getting this query to run. I keep getting an ORA-00933 error.
I'm getting an error message of ORA-00936: missing expression at the very start of
I am continuously getting Error Code The ORA-01033: ORACLE initialization or shutdown in progress
I'm trying to understand different ways of getting table data from Oracle stored procedures
I am getting an error when I attempt to run this query: create table
I'm getting the following error in on Oracle SQL Developer: Error starting at line
Why do I keep getting this error: javax.servlet.ServletException: java.sql.SQLException: [Oracle][ODBC][Ora]ORA-00904: PURCHASE_PRICE: invalid identifier As

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.