Не получается создать триггер:
- Код: Выделить всё
CREATE TRIGGER ins_date_create AFTER INSERT ON civicrm_contact
FOR EACH ROW
BEGIN
SELECT LAST_INSERT_ID() INTO @l_id;
INSERT INTO civicrm_custom_value( custom_field_id, entity_table, entity_id, date_data )
VALUES ( 33, 'civicrm_contact', @l_id, now( ) );
END
Выдает ошибку:
Ошибка
SQL-запрос:
CREATE TRIGGER ins_date_create AFTER INSERT ON civicrm_contact
FOR EACH
ROW
BEGIN
SELECT LAST_INSERT_ID( )
INTO @l_id ;
Ответ MySQL:
#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 'SELECT LAST_INSERT_ID() INTO @l_id' at line 4