查询避免Unknown column ‘xxx’ in ‘where clause’
来源:互联网 发布:php要学多久可以工作 编辑:程序博客网 时间:2024/04/29 18:36
但凡写过sql语句的人估计都曾经碰到过类似于Unknown column ‘xxx’ in ‘where clause’的问题。 单从字面理解,我们很容易得出
列名不存在的结论,但是,很多时候起始并不是由于列名出错造成的。而是由于拼凑sql语句时对字符类型数据没有用引号引起来造成的。
例如:一个hql语句(issueName为string类型):final String hql = "from ActiveCert ac where ac.issuerName="+issueName;
设置issueName值为ysy,则错误如下:
Unknown column
‘ysy′ in ‘where clause’
sql中如果issueName是整型的倒不会出现什么错误,而如果sql中字符串类型必须要包含在引号内。
所以修改hql为:final String hql = "from ActiveCert ac where ac.issuerName='"+issueName+"'";
则错误消失。。
0 0
- 查询避免Unknown column ‘xxx’ in ‘where clause’
- 查询避免Unknown column ‘xxx’ in ‘where clause’
- 查询避免Unknown column ‘xxx’ in ‘where clause’
- 数据库 —— 查询避免 Unknown column ‘xxx’ in ‘where clause’ 错误
- mybatis查询报错 Unknown column 'xxx' in 'where clause'
- Unknown column 'xxx' in 'where clause'错误
- JDBC出现 "Unknown column 'xxx' in 'where clause' "
- TP 框架解决Unknown column 'XXX' in 'where clause' 问题
- msql查询中报错 Unknown column '黄色水果' in 'where clause'
- Unknown column 'rownum' in 'where clause'解决方案
- Unknown column '安妮宝贝' in 'where clause'
- Unknown column '??????' in 'where clause'问题
- Unknown column 'ORGANIZATION_BANK' in 'where clause'
- 中文乱码 unknown column in 'where clause'
- MySql报错原因分析Unknown column ‘xxx’ in ‘where clause’
- Column not found: 1054 Unknown column 'tl10709' in 'where clause'
- c#Bug Unknown column “张三” in 'where clause'问题解决
- mysql Error:1052 Column 'xxx' in where clause is ambiguous
- 通过PLSQL导入csv文件时出现乱码问题
- 第一阶段错题整理
- 无聊游戏随笔--学院篇
- Java数组冒泡,选择,插入三种常用排序法及自带的快速排序法
- js写年月日三级下拉列表框
- 查询避免Unknown column ‘xxx’ in ‘where clause’
- JAVA根据目录读取文件路径
- MyEclipse运行web程序报错,先检查这几点!
- Servlet开发之中线程安全问题
- hive GROUPING SETS通过GROUPING__ID 得到聚合的字段
- 取消Eclipse等号、分号、空格代码自动补全
- 2464 游戏
- javaWeb项目中连接MySQL出现无法加载驱动的问题
- 百度地图 修改定位图标 替换自己的图标