Uploaded image for project: 'iBatis for .NET'
  1. iBatis for .NET
  2. IBATISNET-140

procedure output parameters do work for oracle provider

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • DataAccess 1.7
    • None
    • DataAccess
    • None
    • windows xp vs .NET C#, Oracle ODP.NET for 10g

    Description

      I tried email swap example and the result with two emails not swaped.

      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 = "1_Joe.Dalton@somewhere.com";
      string second = "2_Averel.Dalton@somewhere.com";

      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

      Attachments

        Activity

          People

            Unassigned Unassigned
            zhlu henry lu
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: