« Return to Thread: Problem creating a Trigger

Problem creating a Trigger

by anniyan :: Rate this Message:

Reply to Author | View in Thread

Hi all,

When I am trying to create a trigger I get an error message which I am unable to comprehend.

create trigger updatepricech
 after insert on tbl_prices for each row
BEGIN
  DECLARE closep INTEGER;


select close into closep from temptable where Ticker = new.Ticker;
update tbl_prices set PriceCh = (Close - closep) where Ticker = new.Ticker and Trade_date = new.Trade_date;
end;


I get the error :

#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 '' at line 4

Here line 4 is the declaration part.

Can you please let me know what could be wrong in this query?

 « Return to Thread: Problem creating a Trigger