Reputation: 686
I have a database table that has prefix and phone number fields they are varchar2 so user can enter a phone number as +1999 999-9999 now i need to select the numerical values only and leave out the - in a select statement. So the + sign is selected but the - sign is not selected how can I do this? I am reading up on substr but this is getting confusing
Upvotes: 0
Views: 100
Reputation: 21757
Try this:
select replace(phonenumber,'-','') from yourtable
This will remove the - sign from your select results, while keeping + intact. If you want to remove the + sign as well, just nest the replace
function calls.
Upvotes: 3