Tema: calculos
Ver Mensaje Individual
  #4  
Antiguo 17-07-2004
celades celades is offline
No confirmado
 
Registrado: may 2003
Ubicación: Torroella de Montgrí (Girona)
Posts: 42
Reputación: 0
celades Va por buen camino
Hola hay una udf para truncar, que es lo que tu quieres
te doy pero una solucion que no es perfecta pero creo que tirara bien

Código SQL [-]
CREATE PROCEDURE PRUEBA_CALCULOS (
    P_MONTO NUMERIC(16,2),
    P_DIAS INTEGER)
RETURNS (
    P_SALIDA INTEGER)
AS
begin
if (:P_MONTO/:P_DIAS>0) then
P_SALIDA = (:P_MONTO+0.5) / :P_DIAS -1 ;
else
P_SALIDA = (:P_MONTO-0.5) / :P_DIAS +1 ;

/* PRUEBA CON :P_MONTO = 1520 Y :P_DIAS = 3 DA 506.66666666666666666666666666667 */
/* PERO YO NECESITO QUE ME DE EL ENTERO, YA QUE VERAS EL PROCEDURE RESPONDE COMO 507, YO LO NECESITO 506*/
suspend;
end

Saludos
Responder Con Cita