1

I'm trying to create a mysql function in the install.sql when installing a component. The function starts like this:

DROP FUNCTION IF EXISTS `dm`;

CREATE FUNCTION `dm`(st VARCHAR(55)) RETURNS varchar(128) CHARSET utf8
    NO SQL
BEGIN
  DECLARE length, first, last, pos, prevpos, is_slavo_germanic SMALLINT;
  DECLARE pri, sec VARCHAR(45) DEFAULT '';
  DECLARE ch CHAR(1);
...

It is pretty long so the full version you can find here:
https://github.com/AtomBoy/double-metaphone/blob/master/metaphone.sql

I have found this question:
Create a mysql function while installing a component

But i already removed the delimiters and still get this error when installing the component:

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 '' at line 4 SQL=CREATE FUNCTION `dm`(st VARCHAR(55)) RETURNS varchar(128) CHARSET utf8 NO SQL BEGIN DECLARE length, first, last, pos, prevpos, is_slavo_germanic SMALLINT;
SQL =
CREATE FUNCTION `dm`(st VARCHAR(55)) RETURNS varchar(128) CHARSET utf8
    NO SQL
BEGIN
  DECLARE length, first, last, pos, prevpos, is_slavo_germanic SMALLINT;

The DB error code is 1064.

Community
  • 1
  • 1
Mike
  • 5,416
  • 4
  • 40
  • 73

0 Answers0