Never used functions inside packages. Can you make a procedure instead? in
this case, we use the following:

    <parameterMap id="parameterofProcedure class="HashTable">
      <parameter property="RefCursor" column="REFCURSOR" direction="Output"
dbType="RefCursor"/>
    </parameterMap>

and the <procedure> has a property names "parameterMap =
"parameterofProcedure" resultMap = "..."

With this, you just send an refcursor as parameter, and the refcursor is
opened and processed through the resultMap.

the Hashtable just uses:

Hashtable params = new Hastable();
params.add("RefCursor",null);

ISqlMapper.QueryForList<Widget>("GetWidgets", params)

Greetings!


Define a parameterMap in the procedure statement, and use something like
this:



On Wed, Jun 10, 2009 at 3:02 PM, Uwe Schmitz <uwe.schm...@protegra.com>wrote:

>  I have the following package in an Oracle 9i Database Release 2; I’m
> using the Oracle Data Provider 11.1.0.6.20 and iBATIS DataMapper 1.6.1.
>
>
>
> Calling ISqlMapper.QueryForList<Widget>("GetWidgets", null) produces the
> following error:
>
>
>
> ORA-06550: line 1, column 7:
>
> PLS-00221: 'GET_WIDGETS' is not a procedure or is undefined
>
> ORA-06550: line 1, column 7:
>
> PL/SQL: Statement ignored
>
>
>
> A Google search reveals several articles about getting the Java DataMapper
> to work like this; the FAQ even features an article about using a REF CURSOR
> as an output parameter. No solution to this approach seems to be available.
>
>
>
> Any assistance getting this to work with would be appreciated.
>
>
>
>
>
> *Package Specification*
>
> Package WIDGETS_PKG As
>
>   Function GET_WIDGETS Return SYS_REFCURSOR;
>
> End WIDGETS_PKG;
>
>
>
>
>
> *Package Body*
>
> Package Body WIDGETS_PKG As
>
>   Function GET_WIDGETS Return SYS_REFCURSOR Is
>
>
>
>   WIDGETS SYS_REFCURSOR;
>
>
>
>   Begin
>
>     Open WIDGETS For
>
>     SELECT ID,
>
>       NAME
>
>     FROM WIDGETS
>
>     ORDER BY ID;
>
>
>
>     Return WIDGETS;
>
>   End;
>
> End WIDGETS_PKG;
>
>
>
>
>
> *Widget Class*
>
> namespace Testing {
>
>   public class Widget {
>
>     public int Key {
>
>       get;
>
>       set;
>
>     }
>
>
>
>     public string Name {
>
>       get;
>
>       set;
>
>     }
>
>   }
>
> }
>
>
>
>
>
> *Data Map*
>
> <?xml version="1.0" encoding="utf-8" ?>
>
> <sqlMap namespace="Widget"
>
>         xmlns="http://ibatis.apache.org/mapping";
>
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; >
>
>   <alias>
>
>     <typeAlias alias="Widget"
>
>                type="Testing.Widget, Testing" />
>
>   </alias>
>
>   <statements>
>
>     <procedure id="GetWidgets"
>
>                resultMap="GetWidgetsResultMap">WIDGETS_PKG.GET_WIDGETS</
> procedure>
>
>   </statements>
>
>   <resultMaps>
>
>     <resultMap id="GetWidgetsResultMap"
>
>                class="Widget">
>
>       <result property="Key"
>
>               column="ID" />
>
>       <result property="Name"
>
>               column="NAME" />
>
>     </resultMap>
>
>   </resultMaps>
>
> </sqlMap>
>

Reply via email to