Oracle - SQL - Retornar registros entre incio del ano passado y el proximo

Solución:

select * from <TABLA> where <CAMPO> between to_date('0101' || to_char(trunc(sysdate, 'YEAR')-1, 'YYYY'), 'DDMMYYYY') AND to_date('3112' || to_char(trunc(sysdate, 'YEAR')+1, 'YYYY'), 'DDMMYYYY')

Comments

Popular posts from this blog

Oracle - duplicate fields in RECORD,TABLE or argument list are not permitted

Oracle - ORA-29282: invalid file ID, ORA-06512: at "SYS.UTL_FILE"