ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yusuf" <Yu...@ekalife.co.id>
Subject RE: dynamic insert question
Date Tue, 07 Feb 2006 07:49:52 GMT
Well I think the solution is not using $$ but ##
select #family#,partnum,parttype,'N' from cto.partinfo 

-----Original Message-----
From: stevenlou@gmail.com [mailto:stevenlou@gmail.com]
Sent: Tuesday, February 07, 2006 2:19 PM
To: user-java@ibatis.apache.org
Subject: Re: dynamic insert question

Thanks for your promp reply, but the question isn't in the "domain",
this part is working. The problem is when the select result(first step)
insert into the target table, seems it cann't know the "family" type, so
that it can't insert. 
Actually I want the select is like this:
select $family$,partnum,parttype,'N' from cto.partinfo where ......
And I will input one parameter like '8848' (or others) to family.
What's solution for it?

On 2/7/06, Yusuf < Yusuf@ekalife.co.id <mailto:Yusuf@ekalife.co.id> >

Does the "PartVO" object have a property named "domain" and it's a list
or an array? 

-----Original Message-----
From: stevenlou@gmail.com <mailto:stevenlou@gmail.com>  [mailto:
stevenlou@gmail.com <mailto:stevenlou@gmail.com> ]
Sent: Tuesday, February 07, 2006 1:33 PM
To: user-java@ibatis.apache.org <mailto:user-java@ibatis.apache.org> 
Subject: dynamic insert question

Dear all,

I want insert the table via one dynamic select, the "PartVO" is one 
object and it has "family" attribute, and it's type is "String",

<insert id="insertFamily" parameterClass="PartVO">
insert into cto.partfamily (family,partnum,parttype,active_flag)
select $family$,partnum,parttype,'N' from cto.partinfo where partnum in
<iterate property="domain" open="(" close=")" conjunction=","> 
    #domain[ ]#

But it cause following error,seems the select can't get string value for
"family" column, but in the "PartVO" object, I already defined its type 
is "String", and others are working(I use DB2 database):
Caused by: COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT]
SQL0408N  A value is not compatible with the data type of its assignment
target.  Target name is "FAMILY".  SQLSTATE=42821

How can I make this function working?

Thanks so much for your warm-heated help!


View raw message