0

I am working in Oracle environment. I need to build query that would search through badly formatted telephone data. So far I got :

select * from guest_db
REPLACE(REPLACE(REGEXP_REPLACE(TEL1, '[[:space:]]*',''),'+',NULL),')',NULL),'(',NULL
LIKE '% 
REPLACE(REPLACE(REPLACE(REXEXP_REPLACE('(0)1111 111111','[[:space:]]*',''),'+',NULL),')',NULL)'(',NULL)
||%';

difficulty is putting second nested replace(replace function between '% %' signs without turning them into strings. If I build this function without those percentage signs LIKE function behaves like equal sign. It spits back only exact match ( obviously without special characters like ),(, +, , )... Any help greatly appreciated.

4
  • By "search through" do you mean only find them? Do you also want to fix them? If you want to fix them, can you also describe what makes the phone number valid - for example 999-999-9999 or whatever. Commented Apr 26, 2013 at 13:22
  • can u give some sample data and expected o/p Commented Apr 26, 2013 at 13:28
  • If I put 111 I want to return records like 0-5555-111 as well as 111 111 111. If you put 111 in this query it will return only exact match 111 even though it has LIKE. Commented Apr 26, 2013 at 13:29
  • 1
    OK, solved I had to concate function with '%'|| replace(replace(... ||'%' and jump out of the string. :) Commented Apr 26, 2013 at 13:38

1 Answer 1

0

OK, solved I had to concate function with '%'|| replace(replace(... ||'%' and jump out of the string

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.