Subject Stripping certain characters from strings
Author Daniel Albuschat
Hello,

I have the following problem:

We have a rather huge address database. When an incoming
call arrives at a workstation, it looks up if the phone number is
known in this address database, and if so, displays the according
address on the screen.
But there's a problem with the lookup:
There may be numbers that end in direct access numbers,
like this one:
+49 55544 55

The last whitespace block is the direct call number.
When this certain telephone number arrives from the
workstation's phone, it looks like this:
+49 5554455

Well, I guess you see the problem. I don't know how
I could find the number "+49 55544 55" when I only
have "+49 5554455". Of course, I could try to match
5554455, 55544 55 and 5554 455 for 2 or 3 digit direct call numbers.
But this would only slow things down by the factor of 3...

Now my actual question is, if there's any UDF or built-in function
to strip off certain characters, like everything that's not a number
or all whitespaces or so. Or can I build this as a stored procedure
somehow?
I would like to either have a redundant field filled in a trigger that holds the
number without the stripped characters, or directly call it in the
select statement, like
select * from addresses where strip(telephone)="+49 5554455"
or similar.

Any ideas how to solve my problem?

Thanks,
Daniel

--
eat(this); // delicious suicide