Hi,
I am new to MySQL. Up to now I never needed Transact SQL, but now I have learned it can be useful . MySQL rejects the message Syntax error in insert. Any ideas what I did wrong?
Thanks in advance,
Josh
Here is my Code:
BEGIN
DECLARE @right_most_sibling INTEGER;
SET @right_most_sibling = SELECT rgt FROM personnel WHERE
emp ='Joshua';
UPDATE personnel SET lft = CASE WHEN lft >
@right_most_sibling
THEN lft+2
ELSE lft END,
rgt =CASE WHEN rgt >= @right_most_sibling
THEN rgt +2
ELSE rgt END
WHERE rgt >= @right_most_sibling
INSERT INTO personnel (emp, lft, rgt)
VALUES ('New GUY', @right_most_sibling,
(@right_most_sibling +1))
END;
I am new to MySQL. Up to now I never needed Transact SQL, but now I have learned it can be useful . MySQL rejects the message Syntax error in insert. Any ideas what I did wrong?
Thanks in advance,
Josh
Here is my Code:
BEGIN
DECLARE @right_most_sibling INTEGER;
SET @right_most_sibling = SELECT rgt FROM personnel WHERE
emp ='Joshua';
UPDATE personnel SET lft = CASE WHEN lft >
@right_most_sibling
THEN lft+2
ELSE lft END,
rgt =CASE WHEN rgt >= @right_most_sibling
THEN rgt +2
ELSE rgt END
WHERE rgt >= @right_most_sibling
INSERT INTO personnel (emp, lft, rgt)
VALUES ('New GUY', @right_most_sibling,
(@right_most_sibling +1))
END;