Ver Mensaje Individual
  #1  
Antiguo 08-10-2019
IVAND IVAND is offline
Miembro
 
Registrado: may 2003
Ubicación: ECUADOR
Posts: 523
Reputación: 21
IVAND Va por buen camino
Select con funcion IN como parametro

Hola a todos
Tengo una duda con la funcion In ,
Este es mi SP
Variable definica en el store procedure
Código:
    KEY_FLUJO integer,
    NOMBRE_CUENTA varchar(200),
    CUENTA varchar(50),
    MONTO numeric(15,2),
    LISTA varchar(100),
Código:
FOR select x.key_flujo, 
x.nombre_cuenta, 
X.cuenta,
x.cuentas_afectan
Esta es la cadena que contiene los valores (58,533,23,419,492,29,544,536,576,577,283,284)
Código:
 from flujo_efectivo x  into :key_flujo,:nombre_cuenta,:cuenta,:lista Do
 Begin
  select sum(d.debe-d.haber)
    from cab_diario c ,det_diario d
    where c.key_cab_diario=d.key_cab_diario
    and c.estado='T'
    and extract(year from c.fecha_diario)=:anio
    and d.key_plan_ctas in into :monto ;
sale obvio error de convertir a string, por el parametro que se pasa al IN , alguien de ustedes ha tenido esta duda y como lo ha podido solucionar desde un store procedure

Probe tambien remplazado la variable :lista por este select y no arroja valor alguno
Código SQL [-]
select sum(debe-haber)
from cab_diario c,det_diario d
where c.key_cab_diario = d.key_cab_diario
and c.estado='T'
and extract(year from c.fecha_diario)=2018
and d.key_plan_ctas in (select list(tx.cuentas_afectan) from flujo_efectivo tx where tx.key_flujo=172)
si funciona logicamente si hago esto
Código SQL [-]
select sum(d.debe-d.haber)
 from cab_diario c , det_diario d where c.key_cab_diario=d.key_cab_diario
  and c.estado='T' and extract(year from c.fecha_diario)=:anio
  and d.key_plan_ctas in (58,533,23,419,492,29,544,536,576,577,283,284)



Gracias por su tiempo
__________________
IVAND

Última edición por Casimiro Notevi fecha: 08-10-2019 a las 12:57:44. Razón: Se ve mal el tema
Responder Con Cita