0
votes

Executing the line of SQL:



SELECT 
    BIRTH_MONTH "BIRTH MONTH",          
    BIRTH_COUNTRY "BIRTH COUNTRY",          
    BIRTH_CITY "BIRTH CITY",            
    BIRTH_COUNTY "BIRTH COUNTY"         

 FROM STUDENT_TABLE
  LEFT OUTER JOIN  SYS_GEN.USER_DOB
WHERE BIRTH_MONTH (BIRTH MONTH) <= 
USER_DOB.SYS_GEN_YEAR_MONTH

ORDER BY BIRTH_MONTH;

gives me the following ORACLE error: ORA-00905: Missing keyword

The error is at this line


WHERE BIRTH_MONTH (BIRTH MONTH) <= 

I'm not sure what the missing key words are

2
Missing ON clause. (Instead of WHERE.)jarlh

2 Answers

2
votes

The ON keyword is missing and you have to add On Key word or try like this

0
votes

Explicit joins use the ON keyword to define the join criteria, with WHERE being used for additional filtering.

Also the join condition seems a little odd. Why have you included (BIRTH MONTH)?

Anyway, your query should look like this:

SELECT 
    STUDENT_TABLE.BIRTH_MONTH "BIRTH MONTH",          
    STUDENT_TABLE.BIRTH_COUNTRY "BIRTH COUNTRY",          
    STUDENT_TABLE.BIRTH_CITY "BIRTH CITY",            
    STUDENT_TABLE.BIRTH_COUNTY "BIRTH COUNTY"         

 FROM STUDENT_TABLE
  LEFT OUTER JOIN  SYS_GEN.USER_DOB
    ON STUDENT_TABLE.BIRTH_MONTH <=  USER_DOB.SYS_GEN_YEAR_MONTH

ORDER BY BIRTH_MONTH;

Get into the habit of prefixing all column references in multi-table queries with the table name. It makes things clearer and safer. Use table aliases if table names seem too long.