MySQL数据库定义 function、procedure、trigger报错:syntax error, unexpected end_of_input, expecting
2013-06-29 09:48
405 查看
按照一些教程尝试在 MySQL 的 workbench 写函数,按照例子输入代码老是报错:
“syntax error, unexpected end_of_input, expecting ';' ”.
google之,从官网上得到答案:http://dev.mysql.com/doc/refman/5.1/zh/stored-procedures.html#create-procedure
【出错原因】:默认情况下,mysql是以分号“;”作为一条SQL语句的提交标识符。当我们在编写Function,Store-Procedure,或者触发器的过程中,其中会含有分号“;”;这样就起冲突了,workbench会以分号作为SQL语句提交标识,而Function等代码是以 end 关键字作为提交标识符。
【解决方法】:用delimiter 关键字改变mysql默认的SQL语句的提交标识符。 delimiter 关键字的说明参考:/article/4905386.html
【代码示例】:下面的代码就是将SQL语句的提交标识符设为 "//"
delimiter // -- 将SQL标识符设为 '//' CREATE PROCEDURE simpleproc (OUT param1 INT) BEGIN SELECT COUNT(*) INTO param1 FROM italk.urls; END // delimiter ; -- 将SQL标识符重新设为 ';'
相关文章推荐
- MySQL数据库定义 function、procedure、trigger报错:syntax error, unexpected end_of_input, expecting
- MySQL数据库定义 function、procedure、trigger报错:syntax error, unexpected end_of_input, expecting
- Day60-Oracle04 - PLSQL编程、游标cursor、例外exception、存储过程(procedure)、存储函数(function)、java调用存储过程、触发器(trigger)
- linux脚本相关: Syntax error: end of file unexpected (expecting "then") 提示错误
- oracle 游标,函数 function , 存储过程 PROCEDURE , 触发器 Trigger
- JS:Trim() in javascript, how to define a function of checkinput for a WebControl(ascx)
- Oracle 过程(Procedure)、函数(Function)、包(Package)、触发器(Trigger)
- RMAN-01009: syntax error: found “dot”: expecting one of: “double-quoted-string, equal, identifier, s
- matlab中发生Undefined function 'regessionLoop' for input arguments of type 'char'.
- Undefined function 'im2double' for input arguments of type 'uint8'.
- drivers/input/touchscreen/eeti_ts.c:65:2: error: implicit declaration of function 'irq_to_gpio'
- 解决Undefined function or method 'vgg_kmiter' for input arguments of type 'double'.
- matlab 出现Undefined function 'functionname' for input arguments of type 'logical'问题的解决办法
- 编译海思3520内核时候报错drivers/mfd/ezx-pcap.c:205:2: error: implicit declaration of function 'irq_to_gpio' [-
- python遇到的困难:总是报错EOFError: Ran out of input
- Undefined function 'adb' for input arguments of type 'double'.
- oracle创建trigger procedure function sequence plsql
- the Undefined function 'caffe_' for input arguments of type 'char' 解决办法
- Formats of input argument do not match() in function cvFilter2D cvfilter.cpp
- oracle中的procedure,function,trigger