I have a question. I am making an api with node, express, mysql. When I want to create a procedure in mysql that allows me to add or edit elements to the database, it tells me "The object DDL statement contain syntax error ". Does anyone see the error? Any help is appreciated, ty
CREATE PROCEDURE transactionAddorEdit (
IN _id INT,
IN _type VARCHAR(11),
IN _date,
IN _name VARCHAR(40),
IN _amt decimal(13,2)
)
BEGIN
IF _id = 0 THEN
INSERT INTO transactions (type, date, name, amt)
VALUES (_type, _date, _name, _amt)
SET _id = LAST_INSERT_ID();
ELSE
UPDATE transactions
SET
type=_type,
date=_date,
name=_name,
amt=_amt
WHERE id=_id;
END IF;
SELECT _id AS id;
END