Calling SQL Server Stored Procedure with out parameter

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Calling SQL Server Stored Procedure with out parameter

Bryant Mendez
Hi everybody, the context of my problem is the following: I have a
stored procedure in SQL Server 2005 that does sth and it must return
to me an integer. i call it thus:

<select id="doSth" statementType="CALLABLE"
resultType="java.lang.Integer">
                  { call
                             SP_DO_STH(
                                    #{varIn},
                                    #{varOut}
                                         )}
     </select>

I have this too:
public Object doSth(@Param("varIn")String
varIn,@Param("varOut")Integer varOut);

I call it thus:
                   Integer outVal= 0;
                   Integer i= (Integer)
myMapper.doSth("hello",outVal);

The procedure executes normally and does what have to do. The problem
is that i can't recover the value of my out param. The outVal's value
continues being 0, and the value of my variable i is null.

I've done this with oracle before, but that way doesnt work here:

<select id="doSth" statementType="CALLABLE"
resultType="java.lang.Integer">
                  { call
                             SP_DO_STH(
                                    #{varIn},
 
#{outParameters.varOut ,jdbcType=INTEGER, mode=OUT,
 
javaType=java.lang.Integer}
                                         )}
     </select>

Please there is someone that can help me?

Thanks in advance...