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
1156
July 01, 2020 09:29AM
Re: Issues with converting update command to trigger
575
July 01, 2020 09:33AM
486
July 01, 2020 02:07PM
514
July 02, 2020 05:55AM
499
July 02, 2020 11:59AM
853
July 02, 2020 07:10PM
551
July 02, 2020 09:45PM
542
July 03, 2020 02:53AM
497
July 03, 2020 07:17AM
511
July 03, 2020 10:43AM
480
July 03, 2020 07:46PM
520
July 15, 2020 05:33AM
524
July 15, 2020 10:33AM
551
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.