MariaDB '' 附近的语法不正确 [英] MariaDB incorrect syntax near ''

查看:17
本文介绍了MariaDB '' 附近的语法不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如标题所说,我的语法在某处有错误.这是 MariaDB 10.1.31.

as the title says, I have an error with my syntax somewhere. This is MariaDB 10.1.31.

DROP FUNCTION IF EXISTS NO_UMLAUT;
CREATE FUNCTION NO_UMLAUT(TextString VARCHAR(255)) RETURNS VARCHAR(255)
BEGIN
    SET TextString = REPLACE(TextString, 'ä', 'a');
    SET TextString = REPLACE(TextString, 'ë', 'e');
    SET TextString = REPLACE(TextString, 'ḧ', 'h');
    SET TextString = REPLACE(TextString, 'n̈', 'n');
    SET TextString = REPLACE(TextString, 'ï', 'i');
    SET TextString = REPLACE(TextString, 'ẗ', 't');
    SET TextString = REPLACE(TextString, 'ö', 'o');
    SET TextString = REPLACE(TextString, 'ẅ', 'w');
    SET TextString = REPLACE(TextString, 'ß', 'b');
    SET TextString = REPLACE(TextString, 'ü', 'u');
    SET TextString = REPLACE(TextString, 'ẍ', 'x');
    SET TextString = REPLACE(TextString, 'ÿ', 'y');
    RETURN TextString;
END;

和错误:

 You have an error in your SQL syntax;
 check the manual that corresponds to your MariaDB server version
 for the right syntax to use near '' at line 3.

到目前为止,我尝试了文档中的一个函数,但语法也有错误.我正在 HeidiSQL 9.5.0.5196 中执行此查询.

So far I tried a function from the documentation and there also was an error with the syntax. I am executing this query in HeidiSQL 9.5.0.5196.

推荐答案

我想你只需要 DELIMITER 语句.

I think you just need DELIMITER statements.

函数本身没问题,如 SQL Fiddle 所示(MariaDB 和MySQL 也是如此).

The function itself is fine, as shown by this SQL Fiddle (MariaDB and MySQL are the same for this purpose).

尝试添加:

 DELIMITER $$

 <your function definition>

 DELIMITER ;

这篇关于MariaDB '' 附近的语法不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆