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 "Yee, Richard K CTR DMDC" <Ri...@osd.pentagon.mil> on 2007/05/03 01:01:08 UTC
RE: How do you call a stored procedure with a single OUT paramete
r
Mark,
The syntax is used for IN, OUT, and INOUT parameters. What would you do
if the procedure returned 2 values if ?= was only available?
-----Original Message-----
From: Mark Bleichert [mailto:markbleichert@gmail.com]
Sent: Wednesday, May 02, 2007 3:41 PM
To: user-java@ibatis.apache.org
Subject: Re: How do you call a stored procedure with a single OUT
paramete r
Thanks for the reply, I will try your change tomorrow when I get to the
office.
How ever I am kind of confused here because I have seen the syntax that
you are using before on the mailing list.
Nevertheless I thought that '(?)' after the SP is for 'IN' parameters
and not for 'OUT'.
In standard jdbc '? = function_name(?) ' the '?=' describes the OUT
param whereas (?) after the function is for IN params.
Thanks,
Mark
On 5/2/07, Yee, Richard K CTR DMDC <Ri...@osd.pentagon.mil>
wrote:
Try this:
<parameterMap id="mymap" class="java.util.Map">
<parameter property="value" mode="OUT" />
</parameterMap>
<procedure id="getSequence" parameterMap="mymap">
{ call f_gettsid(?) }
</procedure>
-----Original Message-----
From: Mark Bleichert [mailto: markbleichert@gmail.com
<ma...@gmail.com> ]
Sent: Wednesday, May 02, 2007 11:54 AM
To: user-java@ibatis.apache.org
Subject: How do you call a stored procedure with a single OUT
parameter
I was wondering if you could give me an example of how to call a
stored
procedure in ibatis sqlmaps that has no IN parameters and a
single OUT
parameter of type varchar.
I went through all the mail-archive threads but nothing seemed
to work.
-------------------------------------------------- calling code
----------------------------------------------
Map map = new HashMap();
map.put("value", "0");
map = (HashMap)queryForObject("getSequence", map);
-------------------------------------------------- xml mapping
----------------------------------------------
<parameterMap id="mymap" class="java.util.Map">
<parameter property="value" mode="OUT" />
</parameterMap>
<procedure id="getSequence" parameterMap="mymap">
{ ? = call f_gettsid }
</procedure>
Any suggestion to what I am doing wrong ?
Re: How do you call a stored procedure with a single OUT paramete r
Posted by Mark Bleichert <ma...@gmail.com>.
Thanks guys for the explaination, it didnt solve my problem but atleast I
learned something.
I didnt know '? = function_name' was used only for single OUT's with no
IN's. But most of all
(I almost feel ashamed) i didnt know a procedure could have 2 OUT values.
However I did manage to find a temporary solution to my problem with regard
to procedure that have
a single OUT param. I just wrapped them in a select statement and run it
against dual. Eg.:
'select f_gettsid as tsid from dual' ... works fine !
Actually got an email form Clinton Begin himself.. he told me to look in his
new book 'IBatis in action'. There is
an example on page 121 ! Great way to sell a book hey ;-) Nevertheless I
will buy it soon..
On 5/3/07, Yee, Richard K CTR DMDC <Ri...@osd.pentagon.mil> wrote:
>
> Mark,
> The syntax is used for IN, OUT, and INOUT parameters. What would you do
> if the procedure returned 2 values if ?= was only available?
>
>
>
> -----Original Message-----
> From: Mark Bleichert [mailto:markbleichert@gmail.com]
> Sent: Wednesday, May 02, 2007 3:41 PM
> To: user-java@ibatis.apache.org
> Subject: Re: How do you call a stored procedure with a single OUT
> paramete r
>
> Thanks for the reply, I will try your change tomorrow when I get to the
> office.
> How ever I am kind of confused here because I have seen the syntax that
> you are using before on the mailing list.
> Nevertheless I thought that '(?)' after the SP is for 'IN' parameters
> and not for 'OUT'.
> In standard jdbc '? = function_name(?) ' the '?=' describes the OUT
> param whereas (?) after the function is for IN params.
>
> Thanks,
> Mark
>
>
>
> On 5/2/07, Yee, Richard K CTR DMDC <Ri...@osd.pentagon.mil>
> wrote:
>
> Try this:
>
> <parameterMap id="mymap" class="java.util.Map">
> <parameter property="value" mode="OUT" />
> </parameterMap>
>
> <procedure id="getSequence" parameterMap="mymap">
> { call f_gettsid(?) }
> </procedure>
>
>
>
> -----Original Message-----
> From: Mark Bleichert [mailto: markbleichert@gmail.com
> <ma...@gmail.com> ]
> Sent: Wednesday, May 02, 2007 11:54 AM
> To: user-java@ibatis.apache.org
> Subject: How do you call a stored procedure with a single OUT
> parameter
>
> I was wondering if you could give me an example of how to call a
> stored
> procedure in ibatis sqlmaps that has no IN parameters and a
> single OUT
> parameter of type varchar.
>
> I went through all the mail-archive threads but nothing seemed
> to work.
>
>
> -------------------------------------------------- calling code
> ----------------------------------------------
>
> Map map = new HashMap();
> map.put("value", "0");
>
> map = (HashMap)queryForObject("getSequence", map);
>
>
> -------------------------------------------------- xml mapping
> ----------------------------------------------
>
> <parameterMap id="mymap" class="java.util.Map">
> <parameter property="value" mode="OUT" />
> </parameterMap>
>
> <procedure id="getSequence" parameterMap="mymap">
> { ? = call f_gettsid }
> </procedure>
>
> Any suggestion to what I am doing wrong ?
>
>
>
>
>
>
>
>
>