Note that there are some explanatory texts on larger screens.

plurals
  1. POInvalid scale size. Cannot be less than zero
    text
    copied!<p>I am using spring-2.5.6 to connect from a standalone application to an Oracle 10g database (ojdbc14.jar) using the org.apache.commons.dbcp.BasicDataSource. When I try to retrieve a SqlRowSet using the <code>public SqlRowSet queryForRowSet(String sql, Object[] args) throws DataAccessException</code> method I am getting an 'java.sql.SQLException: Invalid scale size. Cannot be less than zero'.</p> <p>The sql calling the table is:</p> <pre><code>select CUSTAREADESC, BEGCOL, COLLENGTH from CUSTOMERAREA where upper(trim(FLEET)) = upper(trim(?)) and CUSTAREANO = ? </code></pre> <p>The columns BEGCOL and COLLENGTH are of the data type number with no precision defined.</p> <p>I found some information on this issue, seems to be an incompatibility between the Oracle drivers and Sun's implementation of the com.sun.rowset.CachedRowSetImpl.</p> <p><a href="http://forums.sun.com/thread.jspa?threadID=569712" rel="nofollow noreferrer">Java Database Connectivity (JDBC) - Populating CachedRowSet produces SQLException: Invalid scale size</a></p> <p><a href="http://forum.springframework.org/showthread.php?t=19848" rel="nofollow noreferrer">Using queryForRowSet with subquery factoring SQL gives errors </a></p> <p>They suggest changing the sql to the following as a work around. </p> <pre><code>select CUSTAREADESC, (BEGCOL + 0) BEGCOL, (COLLENGTH + 0) COLLENGTH from CUSTOMERAREA where upper(trim(FLEET)) = upper(trim(?)) and CUSTAREANO = ? </code></pre> <p>Does anyone know of a better generic solution that doesn't involve custom sql for any existing table where a column doesn't have precision defined?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload