Re: Issues with converting update command to trigger
a few trigger attempts
_______________________________________
DROP IF EXISTS TRIGGER add_desc
DELIMITER $$
CREATE TRIGGER add_desc
BEFORE INSERT
ON telemetry_log FOR EACH ROW
BEGIN
INSERT device_desc INTO NEW.device_desc
FROM id_name_update;
END$$
DELIMITER ;
DROP IF EXISTS TRIGGER add_desc
DELIMITER //
CREATE TRIGGER add_desc BEFORE INSERT ON telemetry_log
BEGIN
INSERT device_desc INTO NEW.device_desc
From id_name_update
WHERE NEW.device_id = device_id;
END
//
DELIMITER ;
CREATE TRIGGER add_desc AFTER INSERT ON telemetry_log
BEGIN
UPDATE telemetry_log SET id_name_update ON telemetry_log.device_id = id_name_update.device_id SET telemetry_log.device_desc = id_name_update.device_desc WHERE telemetry_log.device_desc IS NULL";
END;
DROP IF EXISTS TRIGGER add_desc
DELIMITER $$
CREATE TRIGGER add_desc
before insert on telemetry_log
UPDATE telemetry_log
SET NEW.device_desc = id_name_update.device_desc
WHERE NEW.devie_desc IS NULL;
end;
$$
delimiter ;
DROP IF EXISTS TRIGGER add_desc
DELIMITER $$
CREATE TRIGGER add_desc
before insert on telemetry_log
UPDATE telemetry_log JOIN id_name_update ON telemetry_log.device_id = id_name_update.device_id
SET telemetry_log.device_desc = id_name_update.device_desc
WHERE telemetry_log.devie_desc IS NULL;
end;
$$
delimiter ;
Subject
Views
Written By
Posted
1137
July 01, 2020 09:29AM
Re: Issues with converting update command to trigger
561
July 01, 2020 09:33AM
479
July 01, 2020 02:07PM
503
July 02, 2020 05:55AM
491
July 02, 2020 11:59AM
836
July 02, 2020 07:10PM
536
July 02, 2020 09:45PM
535
July 03, 2020 02:53AM
483
July 03, 2020 07:17AM
502
July 03, 2020 10:43AM
470
July 03, 2020 07:46PM
510
July 15, 2020 05:33AM
514
July 15, 2020 10:33AM
545
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.