MySQL Forums
Forum List  »  Triggers

Re: Trigger HelpPlease
Posted by: David Guy
Date: July 08, 2015 07:00AM

Hi Peter

Thank you for your reply, that does make sense.
However, please forgive me as I am getting on a bit now and am a newbie at MYSQL, but I tried to do as you suggested and got an 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 'if (new.squawk between 6160 and 6167 or new.squawk between 6171 and 6177) and ne' at line 4

I am sure that I am making a newbie mistake, but haven't got a clue

my code is:
CREATE TRIGGER airfields_insert
BEFORE INSERT
ON realtime
if (new.squawk between 6160 and 6167 or new.squawk between 6171 and 6177) and new.altitude <= 4000 then
insert into airfields (airplane_id,user_id,icao24,created_at,timestamp,altitude,flight_number,latitude,longitude,heading,squawk,horizontal_speed,vertical_speed,Interested) (new.airplane_id,new.user_id,new.icao24,new.created_at,new.timestamp,new.altitude,new.flight_number,new.latitude,new.longitude,new.heading,new.squawk,new.horizontal_speed,new.vertical_speed,new.Interested);
end if;

Thanks and Regards

Dave

www.donnyradar.co.uk

Options: ReplyQuote


Subject
Views
Written By
Posted
2152
July 07, 2015 04:33PM
1331
July 07, 2015 10:26PM
Re: Trigger HelpPlease
1417
July 08, 2015 07:00AM
1281
July 08, 2015 09:42AM
1137
July 15, 2015 03:50AM
1046
July 15, 2015 10:00AM


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.