Springboot项目,使用postgresql数据库,mybatis做持久层框架,

 <select id="select" resultMap="BaseResultMap" parameterType="com.vo.TestVo">
select
<include refid="Base_Column_List" />
from test
where state='2'
<if test="comCode != null" >
and com_code=${comCode}
</if>
</select>

comcode的形式如:'1100'

执行查询时报错:

### The error may exist in file [D:\workspaceAll\eclipseWorkspace\test\target\classes\mapper\custom\test\QcTestDao.xml]
### The error may involve com.dao.TestDao.select-Inline
### The error occurred while setting parameters
### SQL: select id, comcode,name from test where state='2' and com_code=00000000
### Cause: org.postgresql.util.PSQLException: ERROR: operator does not exist: character varying = integer
建议:No operator matches the given name and argument type(s). You might need to add explicit type casts.
位置:286
; bad SQL grammar []; nested exception is org.postgresql.util.PSQLException: ERROR: operator does not exist: character varying = integer
建议:No operator matches the given name and argument type(s). You might need to add explicit type casts.
位置:286] with root cause
org.postgresql.util.PSQLException: ERROR: operator does not exist: character varying = integer
建议:No operator matches the given name and argument type(s). You might need to add explicit type casts.
位置:286

解决方法:

 <if test="comCode != null" >
and com_code=#{comCode,jdbcType=VARCHAR}
</if>

Caused by: org.postgresql.util.PSQLException: ERROR: operator does not exist: character varying = integer的更多相关文章

  1. Cause: org.postgresql.util.PSQLException: ERROR: cached plan must not change result type的前因后果

    首先说明一下遇到的问题: PG数据库,对其中的某张表增加一列后,应用报错,信息如下: 应用使用相关框架如下:SpringBoot.MyBatis. ### Cause: org.postgresql. ...

  2. 【hibernate postgresql】注解@TypeDef/@Enumerated/数据库字段gender为枚举类型,从前台接受到实体后进行保存报错:org.postgresql.util.PSQLException: ERROR: column "gender" is of type gender but expression is of type character varying

    数据库字段gender为枚举类型,从前台接受到实体后进行保存报错:org.postgresql.util.PSQLException: ERROR: column "gender" ...

  3. Caused by: org.postgresql.util.PSQLException: 错误: 语法错误 在 "desc" 、语法错误 在 "from" 附近

    此错误一般是由于postgres的数据库表字段名定义与关键字重名所致: 如下,创建的数据库表包含名称为“desc”的字段与倒叙查询的desc关键字冲突会导致Caused by: org.postgre ...

  4. pg数据库org.postgresql.util.PSQLException: ERROR: "xxx" is not a sequence

    问题场景 对pg数据表执行插入语句的时候,报错如下: { "timestamp": 1587012576734, "status": 500, "er ...

  5. PostgreSql问题:ERROR: operator does not exist: timestamp without time zone > character varying

    问题描述: ERROR:  operator does not exist: timestamp without time zone > character varying 解决方法: //注意 ...

  6. Try setting a different JdbcType for this parameter or a different configuration property. Cause: org.postgresql.util.PSQLException: 栏位索引超过许可范围:2,栏位数:1

    执行mybaits sql <delete id="delete4BatchesByLineCi" parameterType="java.util.List&qu ...

  7. Postgresql客户端不能远程连接数据库服务器 org.postgresql.util.PSQLException:

    Postgresql安装完成之后,默认情况下是不允许远程客户端直接连接的,并且默认的监听配置文件里边,监听的服务器地址是127.0.0.1即:localhost 报如下错误: org.postgres ...

  8. org.postgresql.util.PSQLException: 栏位索引超过许可范围:3,栏位数:2。

    org.postgresql.util.PSQLException: 栏位索引超过许可范围:3,栏位数:2. 今天在写完SQL进行查询的时候,后台一直报错显示上面的信息.看错误完全不知道原因,就重新检 ...

  9. org.postgresql.util.PSQLException:致命:抱歉,已经有太多客户了(org.postgresql.util.PSQLException: FATAL: sorry, too many clients already)

    我正在尝试连接到Postgresql数据库,我收到以下错误: 错误:org.postgresql.util. PSQLException:致命:抱歉,已经有太多客户 错误是什么意思,我该如何解决? 我 ...

随机推荐

  1. Linux 下Tomcat配置远程访问管理端

    1:修改Tomcat默认端口号,将默认的8080修改为8081 apache-tomcat-8.5.31\conf\server.xml <Connector port="8081&q ...

  2. 使用Github添加标签

    Github为我们提供了在页面上进行编辑发行版本的方式,如下图所示: 在Github上为项目打tag可在release页面,选择创建新tag并按下图所示填写即可.删除tag也同理.

  3. sublime text3中文文件名显示为框框,怎么解决

    点击Preferences选项——settings {    "font_size": 20,    "ignored_packages":    [      ...

  4. centos7 mysql数据库安装和配置(转, 未验证)

    一.系统环境 yum update升级以后的系统版本为 [root@yl-web yl]# cat /etc/redhat-release CentOS Linux release 7.1.1503 ...

  5. hihocoder第237周:三等分带权树

    题目链接 问题描述 给定一棵树,树中每个结点权值为[-100,100]之间的整数.树中包含结点总数不超过1e5.任选两个非根节点A.B,将这两个结点与其父节点断开,可以得到三棵子树.现要求三棵子树的权 ...

  6. 简单的redis测试

    //这个方法会多一次 public function testRedisList(){ $num = 10; $user_id = uniqid(); //直接链接本地的redis $redis = ...

  7. SNFAutoupdater通用自动升级组件V2.0

    1.组件介绍 C/S构的特点是能充分发挥客户端的处理能力,很多工作可以由客户端处理后再提交给服务器,对应的优点就是客户端响应速度快模式客户端以其强大的功能,丰富的表现力受到相当大部分用户的青睐,但是客 ...

  8. js 检测变量是否存在

    实际开发过程中,会有判断一个变量是否存在的场景 首先想到的是 if(a==undefined){ console.log("a is undefined") }else{ cons ...

  9. intellij idea (Android studio )外部程序 打开某扩展名(格式)

    最近在为项目开发写思维导图, 为了留下思考的过程和业务逻辑. 本人使用的工具是很可怜的freemind,所以“脑图”的扩展名是“.mm” 情景: 在intellij idea (Android stu ...

  10. 第三部分:Android 应用程序接口指南---第二节:UI---第六章 对话框

    第6章 对话框 一个对话框是一个小窗口,提示用户做出决定或输入额外的信息,一个对话框不填充屏幕并且通常用于在程序运行时中断,然后弹出通知提示用户,从而直接影响到正在运行的程序.图6-1就是对话框的外观 ...