'While using trigger on MariaDB: check the manual that corresponds to your MariaDB server version

The error that I get is on the following: "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DELIMITER $$ CREATE TRIGGER after_insert_update_balance AFTER INSERT ON transact'" THE sql statement that I tried:

String triggerForBalance = "DELIMITER $$" +
                " CREATE TRIGGER after_insert_update_balance " + 
                "AFTER INSERT ON transaction" +
                "FOR EACH ROW" +
                "BEGIN" +
                "IF NEW.betslip_id != NULL THEN" +
                "UPDATE user SET balance = balance - NEW.amount_of_cost;" +
                "END$$" +
                "DELIMITER ;";

What is the reason of this error? If it is related with my MariaDB version how can I resolve this problem?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source