Estás mezclando C con MySQL. Has puesto cosas que nunca vi, y no estoy segudo de que funcionen.
Además, la consulta a mi entender es innecesariamente ineficiente.
Yo la armaría así:
Código MySQL:
Ver original-- --------------------------------------------------------------------------------
-- Routine DDL
-- Note: comments before and after the routine body will not be stored by the server
-- --------------------------------------------------------------------------------
DELIMITER $$
)
a . fecha_venta ,
b . cod_vendedor codigo_vendedor ,
b . nom_vendedor Nombre_vendedor ,
a . num_iden_cliente Identificacion ,
a . nombre_Cliente Cliente ,
a . numero_icc numero_icc ,
a . celular numero_celular ,
b . Valor_recarga valor_recarga ,
D.nombre Distribuidor,
N.nombre Negocio,
b . fecha_recarga ,
b . fecha_Actualizacion
FROM
radicaciones a
INNER JOIN recargas b ON a.Celular = b.num_celular
INNER JOIN distribxnegocio c ON a.id_radicaciones = c.id_radicaciones
INNER JOIN distribuidores D ON D.id_distribuidores = c.id_distribuidor
INNER JOIN negocios N ON N.id_negocio = c.id_negocio
INNER JOIN simcard s ON s.id_simcard = c.id_simcard
WHERE
a.producto = ''PREPAGO''');
IF ((p_fechainicial
!= 0) AND (p_fechafinal
!= 0)) then SET @qryrecdene
= concat(@qryrecdene
, ' AND b.fecha_recarga between ''', p_fechainicial
,''' AND ''', p_fechafinal
, '''');
SET @qryrecdene
= concat(@qryrecdene
, ' order by Negocio'); SET @qryrecdene.
= concat(@qryrecdene
, 'LIMIT ', p_iniciolimit
,',', p_finlimit
);
PREPARE qryexnede
FROM @qryrecdene
;EXECUTE qryexnede;