MySql 中的 DELIMITER 错误

DELIMITER error in MySql(MySql 中的 DELIMITER 错误)
本文介绍了MySql 中的 DELIMITER 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我正在使用以下 sql:

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 ;

我将它存储在 db_auto_increment_settings_procedure.sql 中,当我尝试从 ant 执行它时,我面临以下错误:

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

推荐答案

分隔符仅用于 mysql 客户端(不适用于 API、驱动程序等).
所以,这行不通.

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

查看您的错误消息:-

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

很确定这将在 linux 系统中工作

Pretty sure this will work in linux system

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

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

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

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

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 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在文件系统磁盘足够的情况下,这个文件大小是可以无限增长的。 为了避免ibtmp1文件无止境的暴涨导致
What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)
MySQL groupwise MAX() returns unexpected results(MySQL groupwise MAX() 返回意外结果)
MySQL SELECT most frequent by group(MySQL SELECT 按组最频繁)
Why Mysql#39;s Group By and Oracle#39;s Group by behaviours are different(为什么 Mysql 的 Group By 和 Oracle 的 Group by 行为不同)
MySQL GROUP BY DateTime +/- 3 seconds(MySQL GROUP BY DateTime +/- 3 秒)