当前位置:编程学习 > JAVA >>

ibatis 错误 请各位大侠帮忙

<delete id="DELETE-PROJECT-COMMON-MEMBER-LIST" parameterClass="String">
          delete research_members where project_id = #projectId#:VARCHAR and is_principal = '0'
</delete>
提示错误:
Check the DELETE-PROJECT-COMMON-MEMBER-LIST-InlineParameterMap. --- Check the statement (update failed). --- Cause: 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 'where project_id = '5454761471293546528297197':VARCHAR and is_principal = '0'' at line 1 Caused by: 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 'where project_id = '5454761471293546528297197':VARCHAR and is_principal = '0'' at line 1 
我的程序在where 前夜没有引号啊,为什么会出现引号呢?
请各位帮忙,多谢了 --------------------编程问答-------------------- 去掉varchar --------------------编程问答-------------------- 这个不是引号的问题,引号只是打印错误日志的格式,project_id = '5454761471293546528297197':VARCHAR and is_principal = '0'说这里有语法错误,去掉:VARCHAR再试试。 --------------------编程问答-------------------- 谢谢,去掉varchar还是报错 --------------------编程问答-------------------- 改后是啥样的?这样?
  delete research_members where project_id = #projectId# and is_principal = '0'


改后的完整错误信息是啥? --------------------编程问答--------------------

delete research_members where project_id = '5454761471293546528297197':VARCHAR and is_principal = '0'

先把这条SQL放SQLyog里执行下看通不通再说吧,不通就百度,谷歌.. 通之
然后你再改对应的SQL就没问题了 --------------------编程问答-------------------- 把:VARCHAR去掉,delete写不明白吗 --------------------编程问答-------------------- 把varchar去掉后,提示错误如下:
check the manual that corresponds to your MySQL server version for the right syntax to use near 'where project_id = '5454761471293546528297197' and is_principal = '0'' 
声明:我用的是ibatis连接mysql --------------------编程问答-------------------- 照着6楼说的,去你的MySQL环境里把这条SQL运行一次,看看是不是表名错了,字段名错了,或者需要delete from 表 

有的数据库直接delete table 就可以 我不知道mysql行不行。 --------------------编程问答-------------------- parameterClass中写成"java.lang.string"看看 --------------------编程问答-------------------- parameterClass中写成"java.lang.string"看看 --------------------编程问答-------------------- parameterClass中写成"java.lang.string"看看
补充:Java ,  Java EE
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,