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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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/[EMAIL PROTECTED] >




Reply via email to