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 Vadim <de...@gmail.com> on 2008/09/11 15:09:47 UTC
Fwd: ORA-06572: Function has OUT parameters
Hello,
I've been thinking how to do this for too long now. Ibatis version is
2.1.0.565, Oracle version is 9. What I'm trying to do is map a statement to
a Java class and get one varchar OUT parameter. PL/SQL function is like
function with_out (
in_param in varchar2,
out_message out varchar2
) return some_type;
TYPE some_type
AS TABLE OF some_object
TYPE SOME_OBJECT as object (
id number(9),
class varchar2(16)
);
class SomeClass{
[id, class] setters, getters (as usual)
}
<select id="someSelect"
resultClass="SomeClass">
SELECT id, class
FROM TABLE(with_out (#in:VARCHAR#,#out:VARCHAR#) )
</select>
IbatisDatastore.getSqlMapInstance().queryForList("someSelect", paramMap);
That's what I have now and what gives me a 'Function has an OUT parameter'
error. One solution I see is changing function to procedure and adding one
more out parameter. Unfortunately, I'm not familiar with Ibatis enough to be
able to map 'some_type' OUT parameter to 'SomeClass'.
Would be grateful for any advice you can give!
Re: ORA-06572: Function has OUT parameters
Posted by Vadim <de...@gmail.com>.
I didn't really get your solution. My problem is - you can't have a function
returning a value AND having an OUT parameter in a SQL statement.Question
is: if I convert function 'with_out'
<select id="someSelect"
resultClass="SomeClass">
SELECT id, class
FROM TABLE(with_out
(#in,mode=IN,jdbcType=VARCHAR#,#out,mode=OUT,jdbcType=VARCHAR#) )
</select>
to a procedure with one more OUT parameter
<procedure id="someSelect">
with_out
(#in,mode=IN,jdbcType=VARCHAR#,#out,mode=OUT,jdbcType=VARCHAR#,
#result,mode=OUT,jdbcType= ????? #) )
</procedure>
where #result# is
TYPE some_type AS TABLE OF some_object
how do I map it to a list of java classes? Is it possible with the help of a
typehandler?
On Thu, Sep 11, 2008 at 5:43 PM, Clinton Begin <cl...@gmail.com>wrote:
> Try this, if it's too much to put in your SQL, you can use an external
> parameter map.
>
> #in,jdbcType=VARCHAR,mode=OUT#,
> #out,jdbcType=VARCHAR,mode=OUT#
>
> Clinton
>
>
> On Thu, Sep 11, 2008 at 7:09 AM, Vadim <de...@gmail.com> wrote:
> > Hello,
> >
> > I've been thinking how to do this for too long now. Ibatis version is
> > 2.1.0.565, Oracle version is 9. What I'm trying to do is map a statement
> to
> > a Java class and get one varchar OUT parameter. PL/SQL function is like
> >
> > function with_out (
> > in_param in varchar2,
> > out_message out varchar2
> > ) return some_type;
> >
> > TYPE some_type
> > AS TABLE OF some_object
> >
> > TYPE SOME_OBJECT as object (
> > id number(9),
> > class varchar2(16)
> > );
> >
> > class SomeClass{
> > [id, class] setters, getters (as usual)
> > }
> >
> > <select id="someSelect"
> > resultClass="SomeClass">
> >
> > SELECT id, class
> > FROM TABLE(with_out (#in:VARCHAR#,#out:VARCHAR#) )
> > </select>
> >
> > IbatisDatastore.getSqlMapInstance().queryForList("someSelect", paramMap);
> >
> > That's what I have now and what gives me a 'Function has an OUT
> parameter'
> > error. One solution I see is changing function to procedure and adding
> one
> > more out parameter. Unfortunately, I'm not familiar with Ibatis enough to
> be
> > able to map 'some_type' OUT parameter to 'SomeClass'.
> > Would be grateful for any advice you can give!
> >
> >
>
Re: ORA-06572: Function has OUT parameters
Posted by Clinton Begin <cl...@gmail.com>.
Try this, if it's too much to put in your SQL, you can use an external
parameter map.
#in,jdbcType=VARCHAR,mode=OUT#,
#out,jdbcType=VARCHAR,mode=OUT#
Clinton
On Thu, Sep 11, 2008 at 7:09 AM, Vadim <de...@gmail.com> wrote:
> Hello,
>
> I've been thinking how to do this for too long now. Ibatis version is
> 2.1.0.565, Oracle version is 9. What I'm trying to do is map a statement to
> a Java class and get one varchar OUT parameter. PL/SQL function is like
>
> function with_out (
> in_param in varchar2,
> out_message out varchar2
> ) return some_type;
>
> TYPE some_type
> AS TABLE OF some_object
>
> TYPE SOME_OBJECT as object (
> id number(9),
> class varchar2(16)
> );
>
> class SomeClass{
> [id, class] setters, getters (as usual)
> }
>
> <select id="someSelect"
> resultClass="SomeClass">
>
> SELECT id, class
> FROM TABLE(with_out (#in:VARCHAR#,#out:VARCHAR#) )
> </select>
>
> IbatisDatastore.getSqlMapInstance().queryForList("someSelect", paramMap);
>
> That's what I have now and what gives me a 'Function has an OUT parameter'
> error. One solution I see is changing function to procedure and adding one
> more out parameter. Unfortunately, I'm not familiar with Ibatis enough to be
> able to map 'some_type' OUT parameter to 'SomeClass'.
> Would be grateful for any advice you can give!
>
>