MySQL Forums
Forum List  »  Spanish

Re: Concatenar Campos con un Triggers
Posted by: William Chiquito
Date: February 02, 2012 04:54AM

Hola Ivan,

El problema es que no puedes actualizar la misma tabla que activo el disparador (trigger), en este caso `clientes`, por ello el mensaje de error, revisa B.5.9: Can triggers access tables?

Una alternativa es aplicar la concatenación en el "BEFORE INSERT" del trigger de la siguiente manera:

/* Trigger structure for table `clientes` */

DELIMITER $$

/*!50003 DROP TRIGGER*//*!50032 IF EXISTS */ /*!50003 `combinarNombres` */$$

/*!50003 CREATE TRIGGER `combinarNombres` BEFORE INSERT ON `clientes`
FOR EACH ROW
BEGIN
	set new.`nomCompleto` = concat(new.`nbrClientes`, space(1) , new.`apeClientes`);
END */$$

DELIMITER ;

Espero te sea útil.

Options: ReplyQuote


Subject
Views
Written By
Posted
6084
February 01, 2012 05:21AM
Re: Concatenar Campos con un Triggers
1792
February 02, 2012 04:54AM


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.