View the Exhibit and examine the details of the EMPLOYEES table.
Evaluate the following SQL statement:
SELECT phone_number,
REGEXP_REPLACE(phone_number,'([[:digit:]]{3}).([[:digit:]]{3}).([[:digit:]]{4})’, ‘(\1) \2-\3’) “PHONE NUMBER”
FROM employees;
The query was written to format the PHONE_NUMBER for the employees.
Which option would be the correct format in the output?
A.
xxx-xxx-xxxx
B.
(xxx) xxxxxxx
C.
(xxx) xxx-xxxx
D.
xxx-(xxx)-xxxx
Replace string ‘(1) 2-3’ is missing \
It should be ‘(\1) \2-\3’
otherwise will return exactly (1) 2-3 for every row
and should be like (515) 123-4567
Thanks so much!
Try:
SELECT
REGEXP_REPLACE(‘212.510.0819′,'([[:digit:]]{3}).([[:digit:]]{3}).([[:digit:]]{4})’, ‘(\1) \2-\3’) FROM dual;