Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

is there a function which elminates spaces?

Question posted by: Pierre Couderc (Guest) on November 23rd, 2005 02:04 AM
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.
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
HansH's Avatar
HansH
Guest
n/a Posts
November 23rd, 2005
02:04 AM
#2

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



 
Not the answer you were looking for? Post your question . . .
183,961 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors