Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

the trigger with "if-elseif" does not update the table

so, made a trigger for "picks" table strong text

    delimiter //
create trigger picks_description after insert on picks
for each row
begin
if (new.Picks_Thickness between 0.5 and 0.74) then
insert into Picks (Picks_Desc) values ('медиатор для быстрой игры/ведущей гитары');
elseif (new.Picks_Thickness between 0.87 and 3) then
insert into Picks (Picks_Desc) values ('медиатор для тяжелой игры/ритм-гитары');
end if;
end //

and basically after i try to insert new info, it doesnt update the column Picks_desc

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You need a before insert trigger and a SET syntax

DELIMITER //
CREATE TRIGGER picks_description BEFORE INSERT ON picks
FOR EACH ROW
BEGIN
IF (new.Picks_Thickness between 0.5 and 0.74) THEN
    SET NEW.Picks_Desc = 'медиатор для быстрой игры/ведущей гитары';
ELSEIF (new.Picks_Thickness between 0.87 and 3) then
    SET NEw.Picks_Desc = 'медиатор для тяжелой игры/ритм-гитары';
END IF;
END //
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading