How to select the year in PLSQL?

0

I have a table of data for company officials. I have to show who completed a year of work at the company.

The data type for the yearAdmission field: DATE (dd / mm / yy)

    
asked by anonymous 07.02.2018 / 21:28

3 answers

2

To extract the year you can use:

SELECT idFuncionario, nomeFuncionario, anoAdmissao, EXTRACT (YEAR FROM anoAdmissao) AS ano FROM Tfuncionario

If you want to select who is completing a year today you can use:

SELECT Tfuncionario.* WHERE Mod(Trunc(sysdate) - Tfuncionario.anoAdmissao, 365 ) = 0
    
13.02.2018 / 13:53
2

Does it help?

select * from tfuncionario where anoAdmissao <= '2000/01/01' and anoAdmissao >= '1999/01/01';

where '1999/01/01' the beginning of a date and '2000/01/01' the end.

    
07.02.2018 / 21:35
0

I can count the years, but I could not limit the date to be displayed for a year:

SELECT trunc((months_between(sysdate, to_date(f.ANOADMISSAO,'dd/mm/yy')))/12) AS idade
FROM tfuncionario f

The query will show every year.

    
07.02.2018 / 21:35