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/02 21:26:39 UTC
RE: How do you call a stored procedure with a single OUT paramete
r
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]
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 Jeff Butler <je...@gmail.com>.
The parameter markers in the parenthesis are for both input and output
parameter (remember that a SP may have more than one output parameter).
It's important to understand the differences between a parameter and a
return value...
If the SP truly has a single output paramater, the "call function_name(?)"
is correct.
If the SP has NO parameters, but has a return value, then the syntax is "? =
call function_name"
Since you stated that the SP has a single output parameter, then the first
syntax above is correct.
Jeff Butler
On 5/2/07, Mark Bleichert <ma...@gmail.com> wrote:
>
> 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]
> > 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 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]
> 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 ?
>
>
>
>
>
>