You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Bing Qiao <qi...@gmail.com> on 2005/06/28 18:53:59 UTC
INSERT disrupts Resultset from Stored Procedure?
Dear all,
Another stored procedure issue.
I can't have the following INSERT INTO statement in my stored
procedure. Otherwise, the queryForList won't work (throwing
exception).
Does this insert incur any resultset as well?
Many thanks,
Bing
///////////////////////////////////////
Stored Procedure:
DECLARE @ACT TABLE (PAYMENTID INT, ACT BIT)
INSERT INTO @ACT (PAYMENTID, ACT) values (1,1)
SELECT top 30000
1 AS PAYMENTID,
'L' AS FIRMID,
.....
.....
//////////////////////////////////////////
Call from java:
list = (List) sqlmap.queryForList("TPayment-search", tpayment);
/////////////////////////////////////////
Exception:
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in treasury/ibatis/T_PAYMENT.xml.
--- The error occurred while applying a parameter map.
--- Check the T_PAYMENT.TPaymentParam.
--- Check the results (failed to retrieve results).
--- Cause: java.lang.NullPointerException
Caused by: java.lang.NullPointerException
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWit
/////////////////////////////////////////
Re: INSERT disrupts Resultset from Stored Procedure?
Posted by Bing Qiao <qi...@gmail.com>.
Sorted it out.
I put a SET NOCOUNT ON in the beginning of the stored procedure, which
prevents the number of rows affected by a Transact-SQL statement from
being returned as part of the results.
Cheers
Bing
On 6/28/05, Bing Qiao <qi...@gmail.com> wrote:
> Dear all,
>
> Another stored procedure issue.
>
> I can't have the following INSERT INTO statement in my stored
> procedure. Otherwise, the queryForList won't work (throwing
> exception).
>
> Does this insert incur any resultset as well?
>
> Many thanks,
>
> Bing
>
> ///////////////////////////////////////
> Stored Procedure:
>
> DECLARE @ACT TABLE (PAYMENTID INT, ACT BIT)
>
> INSERT INTO @ACT (PAYMENTID, ACT) values (1,1)
>
> SELECT top 30000
> 1 AS PAYMENTID,
> 'L' AS FIRMID,
> .....
> .....
> //////////////////////////////////////////
> Call from java:
>
> list = (List) sqlmap.queryForList("TPayment-search", tpayment);
> /////////////////////////////////////////
> Exception:
>
> com.ibatis.common.jdbc.exception.NestedSQLException:
> --- The error occurred in treasury/ibatis/T_PAYMENT.xml.
> --- The error occurred while applying a parameter map.
> --- Check the T_PAYMENT.TPaymentParam.
> --- Check the results (failed to retrieve results).
> --- Cause: java.lang.NullPointerException
> Caused by: java.lang.NullPointerException
> at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWit
> /////////////////////////////////////////
>