dbTalk Databases Forums  

is there a function which elminates spaces?

comp.databases.postgresql.general comp.databases.postgresql.general


Discuss is there a function which elminates spaces? in the comp.databases.postgresql.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Pierre Couderc
 
Posts: n/a

Default is there a function which elminates spaces? - 10-24-2005 , 05:34 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.

Reply With Quote
  #2  
Old   
HansH
 
Posts: n/a

Default Re: is there a function which elminates spaces? - 10-24-2005 , 01:00 PM






"Pierre Couderc" <pierre (AT) couderc (DOT) ccNOSPAM> schreef in bericht
news:djidc4$2hgk$1 (AT) biggoron (DOT) nerim.net...
Quote:
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!
Try translating [only] space(s) to .. nothing:
SELECT ... WHERE translate(table.phone_number,' ','') = translate(?,' ','');

be aware this will never use an index!

HansH




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.