#1064 - 您的SQL语法有错误;检查与MySQL服务器版本对应的手册,以便在第19行的'intTableNo'附近使用正确的语法 [英] #1064 - 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 'intTableNo' at line 19

查看:177
本文介绍了#1064 - 您的SQL语法有错误;检查与MySQL服务器版本对应的手册,以便在第19行的'intTableNo'附近使用正确的语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  CREATE   PROCEDURE `FetchSupplierByRequest`(intConferenceId  int ,intRank  int ,intTableNo  int 
BEGIN
SELECT Distinct
c.ID,
c.CompanyName,
c。类型
FROM
conferencetabletop cp,
公司c,
会议m
WHERE
cp。 ConferenceID = intConferenceId
AND
c.ID = m.SupplierID
m.AgendaID = cp.ConferenceId
m.Rank = intRank
ORDER BY
m.CreatedDate DESC
LIMIT 0 ,intTableNo;
END







在服务器上传时出现错误。



错误:#1064 - 您的SQL语法出错;查看与您的MySQL服务器版本对应的手册,以便在第19行的'intTableNo'附近使用正确的语法

解决方案

根据我能找到的信息,旧版本MySQL不能在LIMIT子句中使用变量,必须使用常量。



类似的问题贴在StackOverflow上,附带一些有用的信息。



http://stackoverflow.com/questions/2875238/passing-limit-as-parameters-to-mysql-sproc [ ^

CREATE  PROCEDURE `FetchSupplierByRequest`(intConferenceId int, intRank int,intTableNo int)
BEGIN
SELECT Distinct
c.ID ,
  c.CompanyName,
c.Type
FROM
  conferencetabletop cp,
  companies c,
meeting m
WHERE
  cp.ConferenceID = intConferenceId
    AND
  c.ID = m.SupplierID
and m.AgendaID=cp.ConferenceId
and m.Rank=intRank
ORDER BY
  m.CreatedDate DESC
LIMIT 0, intTableNo;
END




showing the error when its upload in server .

error: #1064 - 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 'intTableNo' at line 19

解决方案

According to the information I can find, older versions of MySQL cannot use variables in the LIMIT clause and constants must be used.

Similar issue posted to StackOverflow with some useful information.

http://stackoverflow.com/questions/2875238/passing-limit-as-parameters-to-mysql-sproc[^]


这篇关于#1064 - 您的SQL语法有错误;检查与MySQL服务器版本对应的手册,以便在第19行的'intTableNo'附近使用正确的语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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