Trim "-" or "- " is not working with phone numbers


right(trim('- ' from, 8) as phone_1,
right(trim('-' from, 8) as phone_2,
right(trim(' ' from, 8) as phone_3, as celular

from addresses

I'm trying to remove the "-" and " " from phone numbers but when I try the characters stay anyway. I've tried it without the right() function and the result is the same. The issue appears to happen when the characters are in between the numbers. Because I could succesfully remove the "+" from a +5491128394716 and the "(" from a (011)37102938 but I was trying to remove "(" and ")" so that is why I suspect that the issue is in between the numbers.


Hi @Vallistruqui
trim only removes characters from the start and end of a string - not the middle.
Since I have no idea which database you're querying, you should look for replace or translate

Thanks a lot!! That did it