title: springframework.jdbc.UncategorizedSQLException :Invalid column type-
body: <p>Hi am trying to do a QueryForInt using spring jbdc.The query returns a simple count.On execution i get springframework.jdbc.UncategorizedSQLException:java.sql.SQLException: Invalid column type.
  I did find similar posts and tried the suggestions but i am still stuck:(...
  Any help is appreciated.</p>
  
  <pre><code>MapSqlParameterSource params = new MapSqlParameterSource();
      params.addValue(DAOConstants.PROD_ID, custVo.getProdId(),OracleTypes.NUMBER);
      params.addValue(DAOConstants.REQ_IND,  DAOConstants.FLAG_Y,OracleTypes.VARCHAR);
  </code></pre>
  
  <p>The query:</p>
  
  <pre><code>  select count(1) from prod where prod_id = :PROD_ID and req_ind =:REQ_IND
  </code></pre>
  
  <p>Table definition</p>
  
  <pre><code>   Name              Null     Type         
     ----------------- -------- ------------ 
     PROD_ID           NOT NULL NUMBER(5)          
     REQ_IND                    VARCHAR2(10) 
  </code></pre>
  
  <p>The Logs..</p>
  
  <pre><code>  Caused by: org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; 
  uncategorized SQLException for SQL [select count(1) from prod where prod_id = :PROD_ID and req_ind = :REQ_IND ]; SQL state [99999]; error code [17004]; Invalid column type; nested exception is java.sql.SQLException: Invalid column type
      at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
      at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
      at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:602)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:636)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:665)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:673)
      at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:728)
      at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:744)
      at org.springframework.jdbc.core.JdbcTemplate.queryForInt(JdbcTemplate.java:775)
      ... 45 more
  Caused by: java.sql.SQLException: Invalid column type
      at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
      at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:199)
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:263)
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:271)
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:445)
      at oracle.jdbc.driver.OraclePreparedStatement.setObjectCritical(OraclePreparedStatement.java:7937)
      at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:7517)
      at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:8174)
      at oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedStatement.java:8155)
      at oracle.jdbc.driver.OraclePreparedStatementWrapper.setObject(OraclePreparedStatementWrapper.java:230)
      at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.setObject(WrappedPreparedStatement.java:724)
      at org.springframework.jdbc.core.StatementCreatorUtils.setValue(StatementCreatorUtils.java:351)
      at org.springframework.jdbc.core.StatementCreatorUtils.setParameterValueInternal(StatementCreatorUtils.java:216)
      at org.springframework.jdbc.core.StatementCreatorUtils.setParameterValue(StatementCreatorUtils.java:144)
      at org.springframework.jdbc.core.ArgPreparedStatementSetter.doSetValue(ArgPreparedStatementSetter.java:65)
      at org.springframework.jdbc.core.ArgPreparedStatementSetter.setValues(ArgPreparedStatementSetter.java:46)
      at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:641)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:586)
      ... 56 more
  </code></pre>