MySQL Forums
Forum List  »  Triggers

Trigger error with update
Posted by: Boris Silva R
Date: April 12, 2006 09:28AM

I am trying to create a trigger with multiple statement encase in a block begin...end sentence with the tool sqlyog.
If i try to use SQL Administrator, the tool realize a page fault.


This is the code sample with one update:
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;

Mysql report error near of update ficha, if modify the trigger for a single update removing the begin...end sentence is created without error.

Error code reported in sqlyog, equal to the error via commandline

Error Code : 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 'update ficha
set pk_paciente = NEW.pk_paciente
where ficha.pk_paciente = OL' at line 5
(21 ms taken)

Error Code : 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 'end' at line 1
(15 ms taken)

Celeron 1.100
256MB
W98SE
Fx1.5.0.1
Java (build 1.5.0_01-b08)
Mysql 5.0.1
SQLYog 5.0.2



Edited 1 time(s). Last edit at 04/12/2006 09:32AM by Boris Silva R.

Options: ReplyQuote


Subject
Views
Written By
Posted
Trigger error with update
7162
April 12, 2006 09:28AM
2208
April 12, 2006 10:19AM
2261
April 12, 2006 11:25AM
2260
April 12, 2006 01:01PM
2079
April 12, 2006 01:17PM
2164
April 12, 2006 02:23PM


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.