el error que me arroja es el siguiente
Código :
PROCEDURE basededatos.miPerfil can't return a result set in the given context
la consulta que ejecutoes la siguiente
Código MySQL :
CALL miPerfil( $id_usr, $id_cam);
y por si interesa el procedimiento almacenado es este
Código MySQL :
DELIMITER $$ DROP PROCEDURE IF EXISTS `miPerfil`$$ CREATE PROCEDURE miPerfil(IN idUsr INT, idCam INT) BEGIN DECLARE nCupones INT; DECLARE id_sup INT; DECLARE id_inf INT; SELECT COUNT(c.`id_cup`) INTO nCupones FROM `users` u INNER JOIN cupones c ON u.`rut` = c.`RUT` AND c.`id_cam` = idCam WHERE `id_usr` = idUsr AND c.`activo` = 1 GROUP BY c.`RUT`; SELECT `id_usr` INTO id_sup FROM `users` u INNER JOIN cupones c ON u.`rut` = c.`RUT` AND c.`id_cam` = idCam WHERE c.`activo` = 1 GROUP BY c.`RUT` HAVING COUNT(c.`id_cup`) > nCupones ORDER BY cupones ASC LIMIT 0,1; SELECT `id_usr` INTO id_inf FROM `users` u INNER JOIN cupones c ON u.`rut` = c.`RUT` AND c.`id_cam` = idCam WHERE c.`activo` = 1 GROUP BY c.`RUT` HAVING COUNT(c.`id_cup`) < nCupones ORDER BY cupones ASC LIMIT 0,1; SELECT u.`nombre` nombre, u.`appaterno` appaterno, u.`apmaterno` apmaterno, COUNT(c.`id_cup`) cupones, ROUND(SUM(m.`monto`)/ COUNT(c.`id_cup`)) monto, ROUND(COUNT(m.`id_man`)/ COUNT(c.`id_cup`)) mandatos FROM `users` u INNER JOIN cupones c ON u.`rut` = c.`RUT` AND c.`id_cam` = idCam AND c.`activo` = 1 INNER JOIN `mandatos` m ON u.`rut` = m.`captadorRut` WHERE u.`id_usr` = idUsr OR u.`id_usr` =id_sup OR u.`id_usr` =id_inf GROUP BY u.`id_usr` ORDER BY cupones DESC; END$$