Invalid Indentifier error with this SQL statement?

Hi, this select statement works fine with MS Access, but i tried to convert it over to an Oracle database (which i've never used bfore) and i get this error:

[Oracle]ORA-00904: "DAY": invalid identifier

and here's the SQL:

SELECT cal_date,(day(cal_date)) AS theprevmonth
FROM eventcal

Please help!

Comments

  • : Hi, this select statement works fine with MS Access, but i tried to convert it over to an Oracle database (which i've never used bfore) and i get this error:
    :
    : [Oracle]ORA-00904: "DAY": invalid identifier
    :
    : and here's the SQL:
    :
    : SELECT cal_date,(day(cal_date)) AS theprevmonth
    : FROM eventcal
    :
    : Please help!
    :

    Oracle does not have a DAY date function to get the day part of a date re-write the query as:

    SELECT cal_date, TO_CHAR(cal_date,'DAY') AS thepremonth FROM eventcal

    The TO_CHAR(date_string,'format_string') function can also take the following format string for month part of a date
    MON - three xter month
    MONTH - month part of the date etc. Check Oracle online references for more.

    Enjoy!


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion