Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/02/2015, 22:29
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:

-------------------------------------------------------------------------------------------------

DROP PROCEDURE IF EXISTS tumba_reserva;

CREATE PROCEDURE tumba_reserva ()
BEGIN

DECLARE hora_actual TIME;


SET hora_actual = CURTIME();


SELECT ( if ( numero_vaucher = '' OR numero_vaucher is Null, 0 )And codigo_estatus_reserva = '2'), hora_reserva
FROM crb_reservacion

IF (hora_reserva - hora_actual) >= 1) THEN

UPDATE crb_reservacion Where codigo_estatus_reserva = 4;
END IF;
END


-------------------------------------------------------------------------------------------------

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


CREATE PROCEDURE tumba_reserva ()
BEGIN

DECLARE hora_actual TIME;
MySQL ha dicho: Documentación

#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 AndresPal; 09/02/2015 a las 23:40