Connecting Tech Pros Worldwide Help | Site Map

is there a function which elminates spaces?

Pierre Couderc
Guest
 
Posts: n/a
#1: Nov 23 '05
In a WHERE clause, I want to to compare strings ignoring the spaces
inside them. Is therd a function to do that? I do not find it in the
documentation.

SELECT ... WHERE (ignore_spaces(table.phone_number) ~* igore_spaces(?));

would be fine but ignore_space() does not exist!
Maybe there is a solution based on regular epxression, but I do not see it.
HansH
Guest
 
Posts: n/a
#2: Nov 23 '05

re: is there a function which elminates spaces?


"Pierre Couderc" <pierre@couderc.ccNOSPAM> schreef in bericht
news:djidc4$2hgk$1@biggoron.nerim.net...[color=blue]
> In a WHERE clause, I want to to compare strings ignoring the spaces
> inside them. Is therd a function to do that? I do not find it in the
> documentation.
>
> SELECT ... WHERE (ignore_spaces(table.phone_number) ~* igore_spaces(?));
>
> would be fine but ignore_space() does not exist![/color]
Try translating [only] space(s) to .. nothing:
SELECT ... WHERE translate(table.phone_number,' ','') = translate(?,' ','');

be aware this will never use an index!

HansH


Closed Thread