Article View: chile.comp.programacion
Article #2048MySQL 5.0, trigger y update consulta
From: gato2005_cl
Date: Mon, 10 Apr 2006 23:59
Date: Mon, 10 Apr 2006 23:59
49 lines
2501 bytes
2501 bytes
Modifique una base de datos(sentencias sql) desde SQLServer a mysql, las sentencias que generan las tablas no tienen ningun problema, no asi los triggers. Los triggers que contienen actualizaciones de datos en un bloque de sentencias begin...end;, por algun motivo no funcionan e indica error en la instruccion set. Las actualizaciones maximas que realizan los triggers so 2 a 3 tablas a la vez , cada una por una sentencia update dentro de un bloque begin...end. En el manual de mysql indica que los triggers pueden contener varias sentencias en un bloque begin...end, y pueden ser de cualquier tipo(insert,update, delete,) al mismo tiempo. Si modifico el trigger eliminando el bloque begin...end pero manteniendo solo una actualizacion el trigger es valido y se crea, si elimino la sentencia update y creo un trigger vacio tambien es valido. ๏ฟฝPorque el update da error al interior de un bloque begin...end, o existe un error en el codigo?. Invalido create trigger tu_pacientes after update on pacientes for each row begin update ficha set pk_paciente = NEW.pk_paciente where (ficha.pk_paciente = OLD.pk_paciente) and (NEW.pk_paciente != OLD.pk_paciente); end; Validos create trigger tu_pacientes after update on pacientes for each row update ficha set pk_paciente = NEW.pk_paciente where (ficha.pk_paciente = OLD.pk_paciente) and (NEW.pk_paciente != OLD.pk_paciente); create trigger tu_pacientes after update on pacientes for each row begin end;
Technical Details
Message-ID:
<e1erin$vub$1@news.nivel5.cl>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news4.google.com!news.glorb.com!nntp-server.pubsub.com!news.nivel5.cl!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 1593cb,7e16e6613b3fe4a2,start X-Google-Attributes: gid1593cb,public X-Google-Language: SPANISH,ASCII Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news4.google.com!news.glorb.com!nntp-server.pubsub.com!news.nivel5.cl!not-for-mail From: gato2005_cl <misforos.chileSINESTO@gmail.com> Newsgroups: chile.comp.programacion Subject: MySQL 5.0, trigger y update consulta Date: Mon, 10 Apr 2006 19:59:48 -0400 Organization: Varios Lines: 49 Message-ID: <e1erin$vub$1@news.nivel5.cl> NNTP-Posting-Host: pc-178-51-86-200.cm.vtr.net Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: news.nivel5.cl 1144713623 32715 200.86.51.178 (11 Apr 2006 00:00:23 GMT) X-Complaints-To: news@news.nivel5.cl NNTP-Posting-Date: Tue, 11 Apr 2006 00:00:23 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows; U; Win98; es-ES; rv:1.7.10) Gecko/20050716 Thunderbird/1.0.7 Mnenhy/0.7.3.0