buenas tardes
tengo el siguiente codigo
Código MySQL:
Ver original-- --------------------------------------------------------------------------------
-- Routine DDL
-- Note: comments before and after the routine body will not be stored by the server
-- --------------------------------------------------------------------------------
DELIMITER $$
)
SET @qryrecdene
= concat('SELECT a.fecha_venta, b.cod_vendedor as codigo_vendedor,
b.nom_vendedor as Nombre_vendedor,
a.num_iden_cliente as Identificacion,
a.nombre_Cliente as Cliente,
a.numero_icc as numero_icc,
a.celular as numero_celular,
b.Valor_recarga as valor_recarga,
(select nombre
from distribuidores
where id_distribuidores = (select id_distribuidor
from distribxnegocio
where id_radicaciones = a.id_radicaciones)) as Distribuidor,
(select nombre
from negocios
where id_negocio in (select id_negocio from distribxnegocio where id_radicaciones = a.id_radicaciones) ) as Negocio,
b.fecha_recarga,
b.fecha_Actualizacion
FROM radicaciones a, recargas b, distribxnegocio c
where a.Celular = b.num_celular
AND a.producto ="PREPAGO"
and a.id_radicaciones = c.id_radicaciones
and a.numero_icc = (select numero_icc from simcard where id_simcard = c.id_simcard)
' );
if ((p_fechainicial
!= 0) and (p_fechafinal
!= 0)) then SET @qryrecdene
= concat('AND b.fecha_recarga between ', p_fechainicial
,' AND ', p_fechafinal
);
SET @qryrecdene
= concat('order by Negocio'); SET @qryrecdene
= concat('LIMIT ', p_iniciolimit
,',', p_finlimit
);
PREPARE qryexnede
FROM @qryrecdene
;EXECUTE qryexnede;
pero al tratar de ejecutarlo me muestra un error de sintaxis, le he buscado una y mil formas de buscar la solucion, pero no he podido.
por favor si me pueden ayudar o darme alguna guia.
gracias de antemano.