当前位置: 首页 > news >正文

postgresql查询时报类型错误解决办法

### The error occurred while setting parameters
### SQL: SELECT dd.detail_id, dd.remind_time FROM dic_tab_map dtm LEFT JOIN dic_spot ds ON dtm.dic_id = ds.dic_id LEFT JOIN dic_detail dd ON dtm.dic_id = dd.dic_id WHERE ds.dept_id = ? AND dtm.table_name = ? AND dtm.column_bus_name = ?
### Cause: org.postgresql.util.PSQLException: ERROR: operator does not exist: bigint = character varying建议:No operator matches the given name and argument types. You might need to add explicit type casts.位置:173
; bad SQL grammar []; nested exception is org.postgresql.util.PSQLException: ERROR: operator does not exist: bigint = character varying建议:No operator matches the given name and argument types. You might need to add explicit type casts.位置:173at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:101)at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:79)at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:79)at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)at com.sun.proxy.$Proxy138.selectList(Unknown Source)at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:224)at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.executeForMany(MybatisMapperMethod.java:166)at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:77)at com.baomidou.mybatisplus.core.override.MybatisMapperProxy$PlainMethodInvoker.invoke(MybatisMapperProxy.java:148)at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:89)at com.sun.proxy.$Proxy235.getDicByTableMap(Unknown Source)at com.ruoyi.data.service.DicJobService.getDicByTableMap(DicJobService.java:26)at com.ruoyi.data.job.DataGet.getZfbaData(DataGet.java:38)... 6 more
Caused by: org.postgresql.util.PSQLException: ERROR: operator does not exist: bigint = character varying建议:No operator matches the given name and argument types. You might need to add explicit type casts.位置:173at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2675)

解决:

使用cast( xx as xx)进行类型转换

selectdd.detail_id ,dd.remind_time
fromdic_tab_map dtm
left join dic_spot ds ondtm.dic_id = ds.dic_id
left join dic_detail dd ondtm.dic_id = dd.dic_id
whereds.dept_id = cast('130123' as bigint)


http://www.mrgr.cn/news/2443.html

相关文章:

  • linux安装go 环境
  • STM32CubeMX 配置串口通信 HAL库
  • nodejs操作gitee图床上传更新和删除
  • 目标检测 | yolov10 原理和介绍
  • 【ocr识别003】flask+paddleocr+bootstrap搭建OCR文本推理WEB服务
  • java JVM ZGC垃圾收集器关键特性和工作原理
  • 3154. 到达第 K 级台阶的方案数
  • http 请求-04-promise 对象 + async/await 入门介绍
  • 【计算机网络】应用层自定义协议与序列化
  • 工业相机错峰启动优化方案
  • 计算机毕业设计选题推荐-旅游景点数据分析-Python爬虫可视化
  • Keepalived总结笔记
  • 8.20Qt作业
  • SEO之网站结构优化(十二-绝对路径和相对路径)
  • Java 的访问控制修饰符
  • 【区块链+商贸零售】NOCO 企业数字化社区 | FISCO BCOS应用案例
  • 【PB案例学习笔记】-33 PB连接Oracle数据库查询数据
  • 如何运用独特的产业运营体系打造一流的数字媒体产业园
  • 客车制造5G智能工厂工业物联数字孪生平台,推进制造业数字化转型
  • 指针和引用的区别