This problem is also the expression of Kauzheng, we first according to the question, the operation is as follows:
hr@ocm> col "PHONE number" for A50
hr@ocm> SELECT phone_number,regexp_replace (Phone_number, ' ([[:d igit:]]{3} )\. ([[:d igit:]]{3}] \. ([[:d igit:]]{4}] ', ' (\1) \2-\3 ') "PHONE number"
2 from employees;
Phone_number PHONE number
----------------------------------------------------------------------
650.507.9833 (650) 507-9833
650.507.9844 (650) 507-9844
515.123.4444 (515) # 123-4444
011.44.1644.429264 011.44.1644.429264
011.44.1644.429263 011.44.1644.429263
011.44.1644.429262 011.44.1644.429262
omit results ...
650.501.4876 (650) 501-4876
650.507.9811 (650) 507-9811
650.507.9822 (650) 507-9822-
rows selected.
According to the query results can be the correct answer is: C
*************************************************************
Regexp_replace function
Let's first look at the traditional replace SQL function, which replaces a string with another string. Suppose your data has unnecessary spaces in the body, and you want to replace them with a single space. With the Replace function, you need to accurately list how many spaces you want to replace. However, the number of extra spaces may not be the same throughout the body. The following example has three spaces between Joe and Smith. The parameters of the Replace function specify that you want to replace two spaces with a single space. In this case, the result leaves an extra space between Joe and Smith in the original string.
SELECT REPLACE (' Joe Smith ', ', ') as
replace from
dual
replace
---------
Joe Smith
The Regexp_replace function advances the substitution function a step further, and its syntax is listed in Table 9. The following query replaces any two or more spaces with a single space. () A subexpression contains a single space that can be repeated two or more times as instructed by {2.}
SELECT regexp_replace (' Joe Smith ',
' () {2,} ', ') as
rx_replace from
dual
rx_replace
--------- -
Joe Smith