ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles Bayon" <ibatis....@gmail.com>
Subject Re: oracle stored function
Date Sun, 24 Sep 2006 16:54:25 GMT
Roberto Rabe is our expert using iBATIS and Oracle, if he sees this
message from his Australia trip may be he will respond.

On 9/22/06, Don Dwoske <don@loraxis.com> wrote:
> I searched the list, and tried many, many things to get iBatis to work
> with a stored FUNCTION (not a PROCEDURE), and I finally came up with
> something that works - but to me, it looks pretty hacked.
>
> My function :
>
>   FUNCTION GetID(
>                i_origin IN VARCHAR2,
>                i_process IN VARCHAR2,
>                i_person IN VARCHAR2 DEFAULT NULL)
>   RETURN NUMBER;
>
> iBatis relevant info :
>
>    <statement id="getid" parameterMap="getid-params">
>        BEGIN ? := REMOTEREG.P_REMOTEREG_REGISTER_REMOTE.GetID(?, ?, ?); END;
>    </statement>
>
>    <parameterMap id="getid-params" class="Model.RemoteReg.GetId">
>        <parameter property="regId"     direction="Output" column="param0" />
>        <parameter property="origin"    direction="Input" />
>        <parameter property="process"   direction="Input" />
>        <parameter property="person"    direction="Input" />
>    </parameterMap>
>
> I tried with all my might (really, I did) to get it working using a
> procedure instead of a statement, but I just couldn't.  I also tried
> with partial might to figure out how to get rid of that ugly param0 in
> as the output parameter name to have it named something nicer.. but no
> luck... I only figured that out by stepping through the code and
> seeing what the result OracleParameterCollection had inside of it.
>
> I looked through the NUnit tests and see a function declared in the
> SQL code (FUNCTION GET_ACCOUNTS_FUNCTION) - but didn't see it tested
> anywhere for an example.
>
> I'm really just glad that I got something that works, but if anyone
> knows a better way to accomplish calling a stored function that
> returns a simple value, please let me know.
>
> -Don
>
> --
>
> ---------------------------------------
> Donald Dwoske
> Software Journeyman
> http://www.loraxis.com/ddwoske
>


-- 
Cheers,
Gilles

<a href="http://www.amazon.com/gp/registry/6JCP7AORB0LE">Wish List</a>

Mime
View raw message