What to do when there are values but result of my operation is null?

"Database returns null if one of the elements of the transaction is null"
- should be test that fields are null or not before the Operation
Example:If field1 is not null and field2 is not null then field1 + field2
Otherwise
If field1 is not null then field1
Otherwise
If field2 is not null Then field2