Coalesce need

Database
Enthusiast

Coalesce need

I have a simple question . IS the Coalesece needed here because we are concatenating with characters '/abc'. So even if the txt is null , we still have '/abc'. So do we need the default value of ' abc' ?
UPDATE table1
SET txt = COALESCE(txt|| '/abc', 'abc')
WHERE ID =123

Thanks!
1 REPLY
Enthusiast

Re: Coalesce need

The result of the concatenation is null if either operand is null. The purpose of COALESCE is to ensure a non-null final result.