You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ibatis.apache.org by ib...@incubator.apache.org on 2005/01/12 04:31:39 UTC
[Apache iBATIS Wiki] New: How do I call a stored procedure?
Date: 2005-01-11T19:31:39
Editor: LarryMeadors
Wiki: Apache iBATIS Wiki
Page: How do I call a stored procedure?
URL: http://wiki.apache.org/ibatis/How do I call a stored procedure?
no comment
New Page:
OK, this is in the User's Guide, but since you apparently did not read it, here it is again. ;-)
Stored procedures are supported via the <procedure> statement element. The following example shows how a stored procedure would be used with output parameters.
{{{
<parameterMap id="swapParameters" class="map" >
<parameter property="email1" jdbcType="VARCHAR" javaType="java.lang.String" mode="INOUT"/>
<parameter property="email2" jdbcType="VARCHAR" javaType="java.lang.String" mode="INOUT"/>
</parameterMap>
<procedure id="swapEmailAddresses" parameterMap="swapParameters" >
{call swap_email_address (?, ?)}
</procedure>
}}}
Calling the above procedure would swap two email addresses between two columns (database table) and also in the parameter object (Map). The parameter object is only modified if the parameter mappings mode attribute is set to INOUT or OUT. Otherwise they are left unchanged. Obviously immutable parameter objects (e.g. String) cannot be modified.
Note! Always be sure to use the standard JDBC stored procedure syntax. See the JDBC Callable``Statement documentation for more information.