Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

why is not months_between working for me ?

sql enthusiastApr 21 2014 — edited Apr 21 2014

select *

from hr.employees

where months_between(hire_date,01-Jan-2000) > 100;

A simple query which check for employees duration of month greater than 100 months but this gives me error of ORA-00904.

hire_date is a date column.

desc hr.employees

Name           Null     Type        

-------------- -------- ------------

EMPLOYEE_ID    NOT NULL NUMBER(6)   

FIRST_NAME              VARCHAR2(20)

LAST_NAME      NOT NULL VARCHAR2(25)

EMAIL          NOT NULL VARCHAR2(25)

PHONE_NUMBER            VARCHAR2(20)

HIRE_DATE      NOT NULL DATE        

JOB_ID         NOT NULL VARCHAR2(10)

SALARY                  NUMBER(8,2) 

COMMISSION_PCT          NUMBER(2,2) 

MANAGER_ID              NUMBER(6)   

DEPARTMENT_ID           NUMBER(4)   

This post has been answered by BrunoVroman on Apr 21 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 19 2014
Added on Apr 21 2014
7 comments
3,053 views