Ver Mensaje Individual
  #11  
Antiguo 24-08-2011
Avatar de fjcg02
[fjcg02] fjcg02 is offline
Miembro Premium
 
Registrado: dic 2003
Ubicación: Zamudio
Posts: 1.410
Reputación: 22
fjcg02 Va camino a la fama
Código SQL [-]
   SELECT PLAT.LINEA FROM PLAT WHERE (((PLAT.LINEA) = :CALLING) 
AND ((PLAT.DESTINO) Like :CALLED) AND ((PLAT.FECHA_HORA_INICIO)>DateAdd(hour,-2,:CALLT) 
And (PLAT.FECHA_HORA_INICIO)hour,2,:CALLT)))
   INTO :LINEA ;
   if (:LINEA IS NULL) then
   begin
    EXIT;
    suspend;
   end
Cambia estas sentencia por
Código SQL [-]
   SELECTcount( PLAT.LINEA) FROM PLAT WHERE (((PLAT.LINEA) = :CALLING) 
AND ((PLAT.DESTINO) Like :CALLED) AND ((PLAT.FECHA_HORA_INICIO)>DateAdd(hour,-2,:CALLT) 
And (PLAT.FECHA_HORA_INICIO)hour,2,:CALLT)))
   INTO :VECES ;
   if (:VECES IS NULL)  then
   begin
    EXIT;
    suspend;
   end

Preguntas cuantos registros cumplen, y ya está. Tengo la duda de que si no hay registros te devuelve null o 0. Compruebalo y nos cuentas.
No puedes devolver en una variable varios valores, que es lo que ocurre cuando hay más de un registro.

Saludos
__________________
Cuando los grillos cantan, es que es de noche - viejo proverbio chino -
Responder Con Cita