Is there anyone can help me out for email swap example?

I have my code:

create or replace procedure
ps_swap_email_address (inout_email_1 in out varchar2, inout_email_2 in out varchar2)
is
tmp_e varchar2(120);
begin
tmp_e := inout_email_1;
inout_email_1 := inout_email_2;
inout_email_2 := tmp_e;
end;
/

<parameterMap id="swap_result" class="System.Collections.Hashtable">
<parameter property="email_1" column="inout_email_1"/>
<parameter property="email_2" column="inout_email_2"/>
</parameterMap>

<statement id="call_ps_swap_email_address" parameterMap="swap_result">
call ps_swap_email_address(?,?)
</statement>

          string first = "[EMAIL PROTECTED]";
          string second = "[EMAIL PROTECTED]";

          Hashtable map = new Hashtable();
          map.Add("email_1", first);
          map.Add("email_2", second);

          sqlMapper.QueryForObject("call_ps_swap_email_address", map);

          Console.WriteLine("1="+map["email_1"].ToString());
          Console.WriteLine("2="+map["email_2"].ToString());

But the results didn't swap the email values.

If I change the sqlmap.xml file to:

<parameterMap id="swap_result" class="System.Collections.Hashtable">
<parameter property="email_1" column="inout_email_1" direction="InputOutput" /> <parameter property="email_2" column="inout_email_2" direction="InputOutput" />
</parameterMap>

I go the following errors:

Object reference not set to an instance of an object.
at IBatisNet.DataMapper.MappedStatements.MappedStatement.RetrieveOutputParame ters(RequestScope request, IDalSession session, IDbCommand command, Object resul
t)
at IBatisNet.DataMapper.MappedStatements.MappedStatement.RunQueryForObject(Re questScope request, IDalSession session, Object parameterObject, Object resultOb
ject)
at IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteQueryForObjec
t(IDalSession session, Object parameterObject, Object resultObject)
at IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteQueryForObjec
t(IDalSession session, Object parameterObject)
at IBatisNet.DataMapper.SqlMapper.QueryForObject(String statementName, Object
parameterObject)


-Henry

Reply via email to