Hi,
I am trying to create a function in DTP. The code is below.
When I execute, I'm getting the following message: 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 //
The MySQL server is version 5.5.0.
Could someone please have a look and advise.
Many thanks,
CODE
DELIMITER //
CREATE FUNCTION make_locale_std_code(parm_language INT(11) UNSIGNED, parm_region INT(11) UNSIGNED) RETURNS int(11) unsigned
READS SQL DATA
DETERMINISTIC
BEGIN
DECLARE result_code varchar(8);
DECLARE language_iso_code varchar(2);
DECLARE region_iso_code varchar(2);
SELECT l10n_language.iso_code into language_iso_code
FROM l10n_language
WHERE l10n_language.id = parm_language_id;
SELECT l10n_region.iso_code into region_iso_code
FROM l10n_region
WHERE l10n_region.id = parm_region_id;
IF CHAR_LENGTH(region_iso_code) = 0
THEN set result_code = language_iso_code;
ELSE set result_code = CONCAT(language_iso_code, '-', region_iso_code);
END IF;
RETURN result_code;
END
//
DELIMITER ;