I wanted to create a TRIGGER for my database. The code is that:
DELIMITER ;
DROP TRIGGER IF EXISTS `spi_financial_request_AINS`;
DELIMITER $$
CREATE
DEFINER = CURRENT_USER
TRIGGER `spi_financial_request_AINS` AFTER INSERT ON `spi_financial_request`
FOR EACH ROW BEGIN
DECLARE ev_id INT;
IF check_audit('spi_financial_request')=1 THEN
INSERT INTO spi_audit_event(table_name, record_id,event_type,user_id)
VALUES('spi_financial_request',new.id,'INS',@user_id);
SELECT LAST_INSERT_ID() INTO ev_id;
INSERT INTO spi_audit_data(event_id,column_name,new_value)VALUES(ev_id,'id',new.id);
INSERT INTO spi_audit_data(event_id,column_name,new_value)VALUES(ev_id,'request_id',new.request_id);
INSERT INTO spi_audit_data(event_id,column_name,new_value)VALUES(ev_id,'payment_type_id',new.payment_type_id);
END IF;
END;
$$
DELIMITER ;
I've executed it on my local site (using SQLyog and 5.6.29 version of MySQL). It works.
But when I tried to use it on DEV server (using PHPMyAdmin and 5.6.32 version of MySQL), I've got an error:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELIMITER' at line 1
I really don't understand what is wrong.