MySQL Forums
Forum List  »  Spanish

AYUDA CON TRIGGER
Posted by: david andres abrigo robles
Date: September 17, 2015 04:54PM

buenas tardes;
podrían darme una mano con mi duda, acerca de los triggers.
la duda es que yo estoy realizanzo un trigger en mi tabla cliente para validar que no se ingresen dos cedulas iguales. y al realizarlo no me arroja ningun resultado ni error, al insertar un cliente con la cedula repetida se ingresa normalmente.
este es mi trigger y dentro de el llamo al procedimiento que setea el nuevo cliente

drop trigger if exists denegaringreso;
DELIMITER $$
CREATE TRIGGER denegaringreso BEFORE INSERT ON Cliente
FOR EACH ROW
BEGIN
declare var varchar(10) ;
SET var = (select distinct cedula from cliente where cliente.Cedula= new.Cedula);
IF var is null then
call SET_NUEVO_CLIENTE(new.Nombre,new.Apellido,new.Cedula,new.TelefonoConvencional,new.TelefonoCelular,new.Direccion,new.Mail,new.fechaInscripcion,new.Estado);
END IF ;
END $$
DELIMITER ;

Options: ReplyQuote


Subject
Views
Written By
Posted
AYUDA CON TRIGGER
2310
September 17, 2015 04:54PM
756
September 21, 2015 11:33AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.