I am using MySql and writing the code below as part of my stored procedure:
SET @label_id_configuration = 0;
IF NOT (SELECT count(1) FROM `system_labels` WHERE `name` = 'configuration') THEN
SELECT @label_id_configuration := Max(`label_id`) + 1 FROM `system_labels`;
INSERT INTO `system_labels` (`label_id`, `name`) VALUES (@label_id_configuration, 'Configuration');
END IF;
It runs fine on my local system. But on the build server, it fails. The rest of the stored procedure runs fine, which means we don't have permission, database, table existence problems.
Could anyone give me a hint to troubleshoot the error message received on the server?
Error on or near line 151: error in SQL script data_update.sql: @label_id_configuration:=`label_id` 6
system_labels(label_id,name) SELECT Max(label_id) + 1, 'Configuration' FROMsystem_labels.