error
Publicado por Jessi (3 intervenciones) el 09/01/2003 15:52:35
creo elcursor de esta manera
donde ya declare anteriormente la variable mes ,anio y todas
declare
@mes int
@anio varchar(5)
declare cursor_cierremensual cursor for Select codigo_cuenta, sum(importedebe) as totaldebe,sum(importehaber) as totalhaber from
(Select codigo_cuenta,SUM(importe_secuencia) as importedebe,'0'as importehaber from cont_comprobante_asiento where criterio_asiento='DEBE and anio_referencia = @anio and month(fec_creacion_documento) = @mes and inicio_periodo='N' and codigo_cuenta is not null
group by codigo_cuenta
union all
Select codigo_cuenta,'0'as importedebe,SUM(importe_secuencia) as importehaber from cont_comprobante_asiento
where criterio_asiento='HABER' and anio_referencia=@anio and month(fec_creacion_documento)=@mes and inicio_periodo='N' and codigo_cuenta is not null
group by codigo_cuenta
UNION ALL
Select con_cuenta,importe_asignado as importedebe,'0'as importehaber from cont_periodocontable_mensual where importe_asignado<=0 and cont_mes= @mes and cont_anio=@anio codigo_cuenta,'0' as importe from cont_comprobante_asiento
UNION ALL
Select con_cuenta,'0'as importedebe,imorte_asignado as importehaber from cont_periodocontable_mensual where importe_asignado<0 and cont_mes= @mes and cont_anio=@anio)a
group by codigo_cuenta
se crea el cursor , hasta ahi todo bien ,pero cuando quiero abrir el cursor sale el error exception_acces_violation y no hace el open
open cursor cierre mensua .... no hace esto
no entiendo por que
posteriormente hay un codigo y tambien fetch cursor_cierremensual into @cuenta,@totaldebe,@totalhaber
end
close cursor_cierremensual
deallocate cursor
Valora esta pregunta


0