better way is to move to Firebird 2.1 which support REPLACE
REPLACE( <stringtosearch>, <findstring>, <replstring> )
Replaces all occurrences of <findstring> in <stringtosearch> with <replstring>.
select replace(x, ' ', ',') from y;
Firebird 2.1 Release Notes