Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/02/2015, 09:53
AndresPal
 
Fecha de Ingreso: febrero-2014
Mensajes: 48
Antigüedad: 10 años, 2 meses
Puntos: 0
Stored Procedure

Hola compañeros estoy haciendo un Stored Procedure que cambie el estado de una reserva guardada en la BD al transcurrir una hora este es el SP:

Código MySQL:
Ver original
  1. -------------------------------------------------------------------------------------------------
  2.  
  3. DROP PROCEDURE IF EXISTS tumba_reserva;
  4.  
  5. CREATE PROCEDURE tumba_reserva ()
  6.  
  7. DECLARE hora_actual TIME;
  8.  
  9.  
  10. SET hora_actual = CURTIME();
  11.  
  12.  
  13. SELECT ( if ( numero_vaucher = '' OR numero_vaucher is Null, 0 )And codigo_estatus_reserva = '2'), hora_reserva
  14. FROM crb_reservacion
  15.  
  16. IF (hora_reserva - hora_actual) >= 1) THEN
  17.  
  18. UPDATE crb_reservacion Where codigo_estatus_reserva = 4;
  19.  
  20.  
  21. -------------------------------------------------------------------------------------------------

Por algún motivo me da este error cuando intento agregarlo a la bd:


Código MySQL:
Ver original
  1. CREATE PROCEDURE tumba_reserva ()
  2.  
  3. DECLARE hora_actual TIME;
  4. MySQL ha dicho: Documentación
  5.  
  6. #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 4

He intentado varias modificaciones y nada, les agradezco su ayuda, gracias de antemano.

Última edición por gnzsoloyo; 10/02/2015 a las 10:34