首页 > 数据库 >postgresql mybatis like查询报错:org.postgresql.util.PSQLException: 栏位索引超过许可范围:1,栏位数:0

postgresql mybatis like查询报错:org.postgresql.util.PSQLException: 栏位索引超过许可范围:1,栏位数:0

时间:2022-12-05 20:35:36浏览次数:63  
标签:... PSQLException code postgresql like 报错 CONCAT

最开始写法:... like '%#{code}%' ...,报错
改成:... like CONCAT('%',#{code},'%') ...,报错
又改成:... like CONCAT('%','#{code}','%') ...,报错
又又改成:... like CONCAT('%','#{code,javaType=String,jdbcType=VARCHAR}','%') ...,报错
又又又改成:... like CONCAT('%',#{code,javaType=String,jdbcType=VARCHAR},'%') ...,还是报错(org.postgresql.util.PSQLException: ERROR: could not determine data type of parameter $1
然后参考https://blog.csdn.net/qq_42651904/article/details/109328018,是数据库版本问题,修改为:

... like CONCAT('%',#{code,javaType=String,jdbcType=VARCHAR}::text,'%') ...

终于好了

标签:...,PSQLException,code,postgresql,like,报错,CONCAT
From: https://www.cnblogs.com/cosmicbison/p/16953373.html

相关文章