Re: Issues with converting update command to trigger
Would you please take a look at this syntax and tell me where i went wrong?
What i have so far throws a ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''unit_of_measure'='%') or
Here's what i have:
delimiter $$
CREATE TRIGGER `do_all` BEFORE INSERT ON `telemetry_log`
FOR EACH ROW
Begin
SET new.device_desc = ( select device_desc from id_name_update where device_id=new.device_id );
IF (NEW'.unit_of_measure'='%')
THEN
SET new.val_cal = ( select hum_cal from id_name_update where device_id=new.device_id);
ELSEIF (NEW.'unit_of_measure'='F')
SET new.val_cal = ( select temp_cal from id_name_update where device_id=new.device_id);
END IF;
SET new.value = new.value + new.val_cal;
END$$
DELIMITER ;
Subject
Views
Written By
Posted
2199
July 01, 2020 09:29AM
1056
July 01, 2020 09:33AM
914
July 01, 2020 02:07PM
994
July 02, 2020 05:55AM
945
July 02, 2020 11:59AM
1394
July 02, 2020 07:10PM
1044
July 02, 2020 09:45PM
1005
July 03, 2020 02:53AM
952
July 03, 2020 07:17AM
1083
July 03, 2020 10:43AM
915
July 03, 2020 07:46PM
Re: Issues with converting update command to trigger
1106
July 15, 2020 05:33AM
1009
July 15, 2020 10:33AM
1020
July 15, 2020 11:02AM
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.