Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error converting data type varchar to int.

 
Russell Ray
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a problem with getting the error code from the callable statement.

I declare position 14 in the callable statement as an INTEGER for the error code. The store procedure runs and comes back, but I receive this error when I try to access the data:


[7/24/06 13:01:17:906 CDT] 7d7d00a2 SystemErr R java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Error converting data type varchar to int.
[7/24/06 13:01:17:906 CDT] 7d7d00a2 SystemErr R at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
[7/24/06 13:01:17:906 CDT] 7d7d00a2 SystemErr R at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
[7/24/06 13:01:17:906 CDT] 7d7d00a2 SystemErr R at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
[7/24/06 13:01:17:906 CDT] 7d7d00a2 SystemErr R at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
[7/24/06 13:01:17:906 CDT] 7d7d00a2 SystemErr R at com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source)
[7/24/06 13:01:17:906 CDT] 7d7d00a2 SystemErr R at com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
[7/24/06 13:01:17:906 CDT] 7d7d00a2 SystemErr R at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown Source)
[7/24/06 13:01:17:906 CDT] 7d7d00a2 SystemErr R at com.microsoft.jdbc.base.BaseStatement.getNextResultType(Unknown Source)
[7/24/06 13:01:17:906 CDT] 7d7d00a2 SystemErr R at com.microsoft.jdbc.base.BaseCallableStatement.getAndValidateOutParameter(Unknown Source)
[7/24/06 13:01:17:906 CDT] 7d7d00a2 SystemErr R at com.microsoft.jdbc.base.BaseCallableStatement.getString(Unknown Source)
[7/24/06 13:01:17:906 CDT] 7d7d00a2 SystemErr R at com.microsoft.jdbcx.base.BaseCallableStatementWrapper.getString(Unknown Source)

Here is the source code for setting up the CallableStatement. All the other parameters are Strings or floats.



call.registerOutParameter(14, java.sql.Types.INTEGER);

/*Executing SP*/
call.execute();



/*Check ErroCode*/
checkDBErrorCode(
fails here >>>>>>>>> call.getInt(14),
"<firstFail>"
+ call.getString(12)
+ "</firstFail> - "
+ call.getString(13),
CLASS_NAME,methodName);





The Store Procedure inputs looks like this:



CREATE PROCEDURE BatchQuickProcess
@p_taskidsVARCHAR(600),
@p_qpstatusVARCHAR(1),
@p_qpreviewoperCHAR(8),
@p_actdescCHAR(10),
@p_dptdescCHAR(10),
@p_tskdescCHAR(10),
@p_tableVARCHAR(1),
@p_defaultwdFLOAT,
@p_defaultwtFLOAT,
@p_wrkbsktVARCHAR(8),
@p_operidVARCHAR(8),
@p_curtskidVARCHAR(11) OUTPUT,
@p_reterrorVARCHAR(255) OUTPUT,
@p_retcodeINT OUTPUT,
@p_commit CHAR(1) = 'Y'



I am using SQL Server 2000 with JDBC Drivers
Version 2.2.0040, Service Pack 3

Any help or insight would be greatly appreciated.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic