Buscar este blog

martes, 5 de mayo de 2015

SQL ORACLE - CALCULOS FECHAS


Buenas,

Comento aquí varias operaciones con fechas que me han resultado interesante.

1) Recuperar fechas superiores a 17/02/2003 sin contar los fines de semanas.

select fecha
from (
select distinct trunc(F_PRET_FECHA_LIMITE_FIN) fecha
from NIM_M_PROYECTO_ESTUDIO_TECNICO
where trunc(F_PRET_FECHA_LIMITE_FIN) > to_date('17/02/2003','dd/mm/yyyy') and
to_number(to_char(F_PRET_FECHA_LIMITE_FIN,'d')) < 6
order by trunc(F_PRET_FECHA_LIMITE_FIN) desc
)


2)Sumar 5 días a la fecha dada.

select to_date('10/06/2007')+5 from dual;


No hay comentarios: