Subject Re: [firebird-support] Re: How to insert only if a matching row does not exist?
Author Milan Babuskov
gastrocus wrote:
> INSERT INTO T1 (type, name, sysid, flag) values (1, 'ZZZZZ', 1, 0)
> WHERE NOT EXISTS (SELECT 1 FROM T1 WHERE name = 'ZZZZZ')

You can apply select to rdb$database table which always returns one row:

INSERT INTO T1 (type, name, sysid, flag)
SELECT 1, 'ZZZZZ', 1, 0 FROM RDB$DATABASE
WHERE NOT EXISTS (SELECT 1 FROM T1 WHERE name = 'ZZZZZ');

HTH

--
Milan Babuskov

==================================
The easiest way to import XML, CSV
and textual files into Firebird:
http://www.guacosoft.com/xmlwizard
==================================