Tema: triggers
Ver Mensaje Individual
  #3 (permalink)  
Antiguo 08/11/2007, 11:07
Avatar de elremolino
elremolino
 
Fecha de Ingreso: mayo-2007
Mensajes: 211
Antigüedad: 17 años
Puntos: 2
Re: triggers

bueno yo tambien estaba buscando lo que necesitas y encontre que tienes que hacer junto con el delimeter los dos palitos "//"
por ejemplo


DELIMITER //
CREATE TRIGGER trCambiarEstadoInsert AFTER INSERT ON tdetallereserva
FOR EACH ROW
BEGIN
UPDATE thabitacion
SET estado = 'ocupado'
where nrohabitacion = NEW.nrohabitacion;
END;//

CREATE TRIGGER trCambiarEstadoDelete AFTER Delete ON tdetallereserva
FOR EACH ROW
BEGIN
UPDATE thabitacion
SET estado = 'libre'
where nrohabitacion = OLD.nrohabitacion;
END;//
DELIMITER ;
Saludos