Need to check whether the employee has crossed the 9 months or not from his joining date.
Asked
Active
Viewed 188 times
-1
-
Please include sample table data and any query you have already tried. – Tim Biegeleisen Jun 27 '18 at 05:46
-
2Possible duplicate of [Calculate difference between 2 date / times in Oracle SQL](https://stackoverflow.com/questions/1096853/calculate-difference-between-2-date-times-in-oracle-sql) – Rene Jun 27 '18 at 05:46
2 Answers
0
Creating sample data as:
create table employee(id number,hire_date date);
insert into employee values(1,'12-APR-2017');
insert into employee values(2,'18-Oct-2017');
insert into employee values(3,'01-Jan-2018');
select id,hire_date, case when months_between(sysdate,hire_date) > 9 then 'Crossed' else 'Not-Crossed' end is_crossed from employee;
The output will be:
ID HIRE_DATE IS_CROSSED
1 12-APR-17 Crossed
2 18-OCT-17 Not-Crossed
3 01-JAN-18 Not-Crossed

Vivek
- 783
- 5
- 11
0
SELECT to_char(TO_DATE(joindt,'DD/MM/RRRR')) < add_months(TO_DATE(SYSDATE),-9) FROM PYEMPMAS
Thanks guys. I got a solution..

Prabha Christ
- 131
- 2
- 2
- 10