SQL state [null]; error code [0]; Invalid scale size

问题描述;oracle10g连接oracle11g  视图v_pick_orders_watch 取自11g数据
javax.servlet.ServletException: StatementCallback; uncategorized SQLException for SQL [select *

from v_pick_orders_watch]; SQL state [null]; error code [0]; Invalid scale size. Cannot be less

than zero; nested exception is java.sql.SQLException: Invalid scale size. Cannot be less than

zero
 org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)
 org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)


root cause
解决:1、原有后台解析sql用了 *;应该写上相应的字段名称;注意把数据字段用nvl(字段,0)函数;保证有数据;
      2、SqlRowSet rs = this.getJdbcTemplate().queryForRowSet(sql);结果集是null;也会报错;
      改为其他方式获取;如this.getJdbcTemplate().queryForList(sql);原因是Spring中实现的问题;
      3、oracle9i或oracle10个dlink连接oracle11g的密码加“小写密码”;

你可能感兴趣的:(java)