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 "Vu, Thai" <Th...@parsons.com> on 2006/01/20 21:45:23 UTC

Passing a NULL value to a parameter of an Oracle stored procedure

Hello,

I have an Oracle stored procedure `myproc' which has 2 parameters which
can be null.

<parameterMap id="myproc_param" class="java.util.Map">
  <parameter property="p1" jdbcType="INTEGER"
javaType="java.lang.Integer" mode="IN" />
  <parameter property="p2" jdbcType="VARCHAR2"
javaType="java.lang.String" mode="IN" />
</parameter>

<procedure id="myproc" parameterMap="myproc_param">
  {call myproc(?, ?)}
</procedure>

In Java:

Map map = new HashMap();
map.put("p1", new Integer(5));
map.put("p2", null); // throws exception at sqlMapClient.queryForObject
....
// map.put("p2", "hi"); // good to go

sqlMapClient.queryForObject("myproc", map); 

I want to pass a null value to the parameter p2, but it seems to me that
iBATIS doesn't accept NULL value. How can I pass a null value to p2?

Sincerely.