maya
.public
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
ot_rw_commandsdisableolder()
Parameters
Name
Type
Mode
Definition
/* To disable older disabling / deacceleration commands once the most recent has been confirmed */ DECLARE BEGIN IF NEW.status = 4 AND NEW.idcommand IN (1,3) THEN WITH q as (UPDATE commandexec ce set enabled = false WHERE iddevice = NEW.iddevice AND idcommand = NEW.idcommand AND enabled = true AND senddate < NEW.senddate AND status <> 4 RETURNING * ) INSERT INTO tmp.commandexec SELECT * FROM q; END IF; RETURN NULL; EXCEPTION WHEN OTHERS THEN RETURN NULL; END;