在MySQL DELIMITER错误 [英] DELIMITER error in MySql

查看:840
本文介绍了在MySQL DELIMITER错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的SQL语句:

  DELIMITER $$DROP PROCEDURE IF EXISTS`get_auto_increment_settings` $$CREATE PROCEDURE`get_auto_increment_settings`()
开始
    选择@@ global.auto_increment_offset为偏移,@@ global.auto_increment_increment为增量;END $$
DELIMITER;

我保存这db_auto_increment_settings_procedure.sql,当我试图从蚂蚁执行此,我面临着以下错误:

  [SQL]执行资源:/mysql/install/db_auto_increment_settings_procedure.sql
[SQL]无法执行:DELIMITER
[SQL] com.mysql.jdbc.exceptions.MySQLSyntaxErrorException:你在你的SQL语法错误;检查对应于你的MySQL服务器版本在1号线附近使用DELIMITER'正确的语法手册
[SQL]无法执行:DELIMITER;
[SQL] com.mysql.jdbc.exceptions.MySQLSyntaxErrorException:你在你的SQL语法错误;检查对应于你的MySQL服务器版本在1号线附近使用DELIMITER'正确的语法手册


解决方案

分隔符仅由MySQL客户端(不是在API,驱动器...等)使用。结果
因此,它不会工作。

请参阅您的错误信息: -

  [SQL]执行资源:/mysql/install/db_auto_increment_settings_procedure.sql
[SQL]无法执行:DELIMITER

pretty确信这在Linux系统中运行。

 的mysql -u根-pxxx -h YYY< YOUR_SQL.sql

如果适用,您只需使用手动mysql客户端创建存储过程,结果
而且是一个没有汗的解决方案。

如果您需要动态地创建这一点,结果
这个文档可能会提供一些​​见解的信息结果
http://dev.mysql.com/doc /refman/5.0/en/connector-j-usagenotes-basic.html

I am using the following sql:

DELIMITER $$

DROP PROCEDURE IF EXISTS `get_auto_increment_settings`$$

CREATE PROCEDURE `get_auto_increment_settings`()
BEGIN   
    select @@global.auto_increment_offset as 'offset', @@global.auto_increment_increment as 'increment' ;

END $$
DELIMITER ;

I stored this in db_auto_increment_settings_procedure.sql and when I am trying to execute this from ant, I am facing the following error:

[sql] Executing resource: /mysql/install/db_auto_increment_settings_procedure.sql
[sql] Failed to execute:  DELIMITER
[sql] com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: 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' at line 1
[sql] Failed to execute:  DELIMITER ;
[sql] com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: 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' at line 1

解决方案

The delimiter is used only by mysql client (not on API, driver ... etc).
So, it won't work.

See your error message :-

[sql] Executing resource: /mysql/install/db_auto_increment_settings_procedure.sql  
[sql] Failed to execute:  DELIMITER

Pretty sure this will work in linux system

mysql -u root -pxxx -h yyy < YOUR_SQL.sql

If applicable, you just manually create the stored procedure using mysql client,
and is a no-sweat solution.

If you need to create this dynamically,
this doc might provide some insight information
http://dev.mysql.com/doc/refman/5.0/en/connector-j-usagenotes-basic.html

这篇关于在MySQL DELIMITER错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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