I would like to update or insert a row in a Firebird 2.5 table, but I want the values I'm inserting to be ignored if they are null.
I was hoping something like this would do it:
update or insert into TargetTable
( FieldA, FieldB )
values
( :fielda, coalesce(:fieldb, FieldB ))
However, Firebird does not allow the reference to FieldB in the 'values' list.
It does allow this update syntax:
update TargetTable
set FieldB = coalesce( :fieldb, FieldB )
where
FieldA = :fielda
But this requires me to handle inserts separately.
Is there a way to get both update/insert and a coalesce on the field value?