ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Larry Meadors <larry.mead...@gmail.com>
Subject Re: Re: Conditional execution w/o SP
Date Tue, 06 Sep 2005 22:42:03 GMT
Can you do this with your database?: 

insert into table (...) values (...) 
where someValeu in (select something from someTable where yourCondition)

Some databases (for sure PG SQL and M$ SQL) allow this.

Larry


On 6 Sep 2005 22:33:38 -0000, sreenivas <ko_srinivas@rediffmail.com> wrote:
> 
> 
> Hi Larry,
> 
> Thanks for the response. I agree with your suggestion to place the 
> condition in DAO class, but I wanted to do this for one reason.
> 
> I want to check status of a particular field using select, if there exists 
> data for the select in that nano second, no insert should be made, insert 
> new row(s) otherwise.
> 
> Please let me know pseudo code, if possible.
> 
> Thanks,
> Sreenivas
> 
> 
> 
> On Wed, 07 Sep 2005 Larry Meadors wrote :
> >Sort of - you could do it with a statement using dynamic sql, but you 
> will
> >not be able to use the selectKey element.
> >
> >IMO this is a bad idea - do the logic in your DAO class instead of in a
> >mapped statement.
> >
> >Larry
> >
> >
> >On 6 Sep 2005 21:29:00 -0000, sreenivas <ko_srinivas@rediffmail.com> 
> wrote:
> > >
> > > Hi,
> > >
> > > I have a requirement where I need to do conditional SQL
> > > execution(insert/update).
> > >
> > > I would like to know whether or not this is possible in iBatis without
> > > writing any stored procedure.
> > >
> > > Thanks and regards,
> > > Sreenivas
> > >
> > >
> > > <
> http://adworks.rediff.com/cgi-bin/AdWorks/sigclick.cgi/www.rediff.com/signature-home.htm/1507191490@Middle5?PARTNER=3
> >
>  
> 
> <http://adworks.rediff.com/cgi-bin/AdWorks/sigclick.cgi/www.rediff.com/signature-home.htm/1507191490@Middle5?PARTNER=3>

>

Mime
View raw message