Ver Mensaje Individual
  #1 (permalink)  
Antiguo 31/07/2012, 12:27
fiu_666
 
Fecha de Ingreso: junio-2012
Mensajes: 19
Antigüedad: 11 años, 10 meses
Puntos: 1
Exclamación Problema con los Procedimientos Almacenados en el Servidor

Hola a todos.

Estoy desarrollando un Sistema de Hotel.
Como base de datos estoy utilizando el MySql con Procedimientos Alamcenados y muchos con de ellos Sentencias Preparadas.
El Problema es que los Procedimientos Alm. con Sentencias Preparadas no ejecutan y los Procedimientos Alm. normales sí.
Tengo que eliminarlos y crearlos de nuevo para poder trabajar el Sistema. Lo curioso es que de manera local trabajan al 100%,
los subos al servidor y funcionan bien; pero al dia siguiente muchos de ellos no ejecutan y son los Procedimientos con Sentencias Preparadas.

Este es uno de los Procedimiento almacenado con Sentencias Preparadas que manejo.

Código MySQL:
Ver original
  1. DECLARE sentencia VARCHAR(1500);
  2.         DECLARE sentenciaLimit VARCHAR(100);
  3.         DECLARE sentenciaETH VARCHAR(100);
  4.         DECLARE sentenciaETH2 VARCHAR(100);
  5.         DECLARE sentenciaHouse VARCHAR(100);
  6.         DECLARE sentenciaOrder VARCHAR(100);
  7.         DECLARE sentenciaFinal VARCHAR(3000);
  8.         DECLARE sentenciaGroup VARCHAR(100);
  9.  
  10.         SET @sentenciaETH = '';
  11.         SET @sentenciaETH2 = '';
  12.         SET @sentenciaHouse = '';
  13.         SET @sentenciaOrder = '';
  14.         SET @sentenciaFinal = '';
  15.         SET @sentenciaLimit = '';
  16.         SET @sentenciaGroup = '';
  17.  
  18.         SET @sentencia = CONCAT('
  19.         SELECT
  20.             habitacion.hab_nro,
  21.             habitacion.hes_id,
  22.             habitacion.hab_eliminado,
  23.             habitacion.hke_id,
  24.             habitacion.hab_id,
  25.             habitacion_tipo_habitacion.hth_id,
  26.             tipo_habitacion.tha_descripcion,
  27.             house_keeping.hke_descripcion,
  28.             house_keeping.hke_icono,
  29.             habitacion_estado.hes_descripcion,
  30.             habitacion_estado.hes_color,
  31.             habitacion_tipo_habitacion.tha_id,
  32.             habitacion_tipo_habitacion.estado,
  33.             reservas.res_id,
  34.             reservas.res_estado
  35.         FROM
  36.             habitacion
  37.         LEFT OUTER JOIN habitacion_tipo_habitacion ON habitacion.hab_id = habitacion_tipo_habitacion.hab_id
  38.         LEFT OUTER JOIN tipo_habitacion ON habitacion_tipo_habitacion.tha_id = tipo_habitacion.tha_id
  39.         LEFT OUTER JOIN house_keeping ON habitacion.hke_id = house_keeping.hke_id
  40.         LEFT OUTER JOIN habitacion_estado ON habitacion.hes_id = habitacion_estado.hes_id
  41.         LEFT OUTER JOIN reservas ON habitacion_tipo_habitacion.hth_id = reservas.hth_id
  42.         WHERE habitacion.hab_eliminado = 0 ');
  43.  
  44.         SET @sentenciaOrder = CONCAT(' ORDER BY ',p_campo_orden,' ',p_tipo_orden);
  45.         SET @sentenciaGroup = CONCAT(' GROUP BY habitacion.hab_nro');
  46.  
  47.         IF p_hke_id > 0 THEN
  48.             SET @sentenciaHouse = CONCAT(' AND habitacion.hke_id=',p_hke_id);
  49.         END IF;
  50.  
  51.         IF p_tha_id > 0 THEN
  52.             SET @sentenciaETH = CONCAT(' AND habitacion_tipo_habitacion.tha_id = ',p_tha_id);
  53.         END IF;
  54.  
  55.         IF p_hes_id > 0 THEN
  56.             SET @sentenciaETH2 = CONCAT(' AND habitacion.hes_id = ',p_hes_id);
  57.         END IF;
  58.  
  59.         IF p_limit != '' AND p_offset != '' THEN
  60.             SET @sentenciaLimit = CONCAT(' LIMIT ',p_offset,',',p_limit);
  61.         END IF;
  62.  
  63.         SET @sentenciaFinal = CONCAT(@sentencia,@sentenciaETH,@sentenciaETH2,@sentenciaHouse,@sentenciaGroup,@sentenciaOrder,@sentenciaLimit);
  64.         PREPARE consulta FROM @sentenciaFinal;
  65.         EXECUTE consulta;
  66.         DEALLOCATE PREPARE consulta;

Agradeceria su ayuda para solucionar este problema.