Ver Mensaje Individual
  #2 (permalink)  
Antiguo 27/08/2014, 07:38
Avatar de huesos52
huesos52
Colaborador
 
Fecha de Ingreso: febrero-2009
Ubicación: Manizales - Colombia
Mensajes: 5.980
Antigüedad: 15 años, 2 meses
Puntos: 360
Respuesta: seleccionar fecha en sentencia case

Que error te sale?

Igual prueba lo siguiente:



Código SQL:
Ver original
  1. SELECT
  2. ,CASE WHEN AI.FECHA_INGRESO < TRUNC(SYSDATE,'MM') THEN (TRUNC (TO_DATE(ALTA.FECHA_ALTA))-TRUNC(SYSDATE,'MM'))
  3.           WHEN AI.FECHA_INGRESO >= TRUNC(SYSDATE,'MM') THEN (0)

Lo que hace el trunc con el parametro MM es tomar el primer dìa del mes y el año ya en formato DATE sin necesidad de complicarte en las conversiones.
__________________
Without data, You are another person with an opinion.
W. Edwads Deming