我的 jsp 页面上有一个表,其中有一列由 CLOB 类型的数据库列填充。我在执行此操作时遇到了一些麻烦,并且看到了其他有关此问题的问题,但答案对我不起作用。这是我的声明,其中评论是 CLOB。
stmt = conn.prepareStatement("SELECT DISTINCT restriction, person, start_date, end_date, comments "
+ " FROM restrictions WHERE person = ? "
+ " AND (start_date BETWEEN TO_DATE (? , 'yyyy/mm/dd') AND TO_DATE (? , 'yyyy/mm/dd') "
+ " OR start_date < TO_DATE (? , 'yyyy/mm/dd') AND end_date IS NULL) " );
stmt.setString(1, Id);
stmt.setString(2, StartRest);
stmt.setString(3, EndRest);
stmt.setString(4, EndRest);
result = stmt.executeQuery();
然后我将在 while 循环中有列:
while (result.next()) {
restrictions = StringUtils.defaultString(result.getString("str_restriction"));
.......
// here is where I would get my Clob data from the query.
所以,基本上,我想知道是否有办法在查询中翻译 CLOB,甚至在 java 代码中,这样它就可以在我的页面中使用。