Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » DTP » DELIMITER not being recognised for MySQL Query(Need to use DELIMiTER in Create Function in MySQL database - getting a syntax error when I execute.)
DELIMITER not being recognised for MySQL Query [message #1081444] Wed, 07 August 2013 04:34
Flavelle Ballem is currently offline Flavelle Ballem
Messages: 40
Registered: July 2009
Member
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 ;
Previous Topic:Multitenancy and Entity Manager
Next Topic:Freeze in DB Development perspective
Goto Forum:
  


Current Time: Fri Aug 29 08:22:16 EDT 2014

Powered by FUDForum. Page generated in 0.02421 seconds