Subject | Re: [firebird-support] Re: How to insert only if a matching row does not exist? |
---|---|
Author | Paul Vinkenoog |
Post date | 2011-10-21T02:41:25Z |
Hi Ed,
merge
into emp
using rdb$database
on emp.fruits = 'mango'
when not matched then insert (fruits) values ('mango')
Cheers,
Paul
> > mergeJust realized you can make it even easier:
> > into emp
> > using (select 'mango' fruits from rdb$database) src
> > on emp.fruits = src.fruits
> > when not matched then insert (fruits) values ('mango')
>
> Nice trick! That seems to work.
merge
into emp
using rdb$database
on emp.fruits = 'mango'
when not matched then insert (fruits) values ('mango')
Cheers,
Paul