oracle jdbcTemplate无效的列类型 [英] oracle jdbcTemplate Invalid column type

查看:179
本文介绍了oracle jdbcTemplate无效的列类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从数据库中删除行时,我正在使用以下代码

I am using below code while deleting a row from database

jdbcTemplateObject.update("DELETE FROM SUPERVISION_ROOM cl WHERE cl.fk_group IN ? and cl.fk_room IN ?", gourpIds, deleteExamDTO.getRoomIds());

但是我遇到以下异常:

PreparedStatementCallback;未分类的SQLException for SQL [DELETE来自SUPERVISION_ROOM cl在哪里cl.fk_group IN?和cl.fk_room IN吗?];SQL状态[99999];错误代码[17004];无效的列类型;嵌套的异常为java.sql.SQLException:具有根的无效列类型]原因

PreparedStatementCallback; uncategorized SQLException for SQL [DELETE FROM SUPERVISION_ROOM cl WHERE cl.fk_group IN ? and cl.fk_room IN ?]; SQL state [99999]; error code [17004]; Invalid column type; nested exception is java.sql.SQLException: Invalid column type] with root cause

推荐答案

当您尝试使用JDBCTemplate时,JDBCTemplate不支持透明 IN列表绑定.

JDBCTemplate does not support a transparent IN list binding as you try to use it.

它记录在 11.7.3中.传入IN子句的值列表

您可能必须准备好所需数量的占位符,然后进行多种变体,或者一旦知道需要多少个占位符,就必须动态生成SQL字符串.

You would have to either have a number of variations with the desired number of place holders prepared or you would have to dynamically generate the SQL string once you know how many place holders are required.

因此,基本上,您必须首先扩展具有正确数量的占位符的SQL语句,然后将每个元素作为单独的参数传递.

So basically you must first expand the SQL statement with the right number of placeholders and then pass each element as a separate paramater.

...
WHERE cl.fk_group IN (?,?,?,?) and cl.fk_room IN (?,?)

这篇关于oracle jdbcTemplate无效的列类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆