'Oracle to MySql syntax changes
I'm working on converting a whole project from Oracle to mySql. I've been trying to figure out where the syntax is wrong here. Any ideas?
CREATE TRIGGER payment_check BEFORE DELETE ON members FOR EACH ROW
BEGIN
DECLARE v_payment_due DECIMAL(6, 2); // this line returns error
Solution 1:[1]
MySQL syntax is quite a bit different from Oracle. Your trigger should look something like this:
CREATE TRIGGER payment_check
BEFORE DELETE ON members
FOR EACH ROW
BEGIN
DECLARE v_payment_due DECIMAL(6, 2);
SET @v_payment_due := 1.23;
END;
Solution 2:[2]
in mysql syntax is like
DELIMITER $$
CREATE TRIGGER trigger_name
BEFORE DELETE
ON table_name FOR EACH ROW
BEGIN
-- statements
END$$
DELIMITER ;
for your reference refer this link
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Bob Jarvis - Слава Україні |
| Solution 2 | Sangat |
