When I do a select like this
select
replace(replace(t.field,'{0}',t.parameter01), '{1}', t.parameter02)
from table t
I obtain a null result even if t.field contain text without any placeholders. Can somebody explain why this happens?
I already figured out. If the third parameter of replace function is null, the result will be null although the second one doesn't match anything in the first one. An workaround is to replace the value of third parameter if it is null:
select
replace(t.field, t.parameter01, coalesce(t.parameter02, ''))
from table t
insert into...)