Method 1 You can use the replacement in the search query. For example: "Select * from the client, where replace (phoneNumber, '-', '') = '212-232-3333' The disadvantage of this method is that you will not be able to use any index, and the search will be (very) slow.
Method 2 In a separate column of the table also keep a clean version of the phone (the artificial column is "phoneNumberClean"), which does not have special characters. When you update records in the main column, also update them in the "clean" column.
Method 3 The third method is to create an index based on functions, which is possible in Oracle. It allows you to search by method 1 without the artificial column of method 2 and have a quick, indexed search. But if you use MySQL, then you cannot use this method because MySQL does not support function-based indexes. Then your best option is to use parameter 2 (artificial column) and use the update trigger.
source share