SELECT Z.*,
		          regexp_substr(Z.CLEANED,'[9][0-9]{8}') telefono
		   FROM(
           SELECT RUC_PROV, TELEF_CONTACTO, 
		          CASE WHEN TELEF_CONTACTO LIKE '' THEN TELEF_CONTACTO
				       ELSE REGEXP_REPLACE(STRTOK(STRTOK(TELEF_CONTACTO,'*',1), '/', 1), '[-+#(),* a-zA-Z]', '') END CLEANED
		   FROM E_DW_VIEWS.V_MST_VPC_BASES_ECOSIS_BC 
		   WHERE RUC_PROV IN ('RPC 997 681 215','20527597651','20110353538','20510037562','20602067158', '20513646608', '20533294970', '20101293387', '20537900891', '20600612922', '20507141791', '20492916472')
		   AND TELEF_CONTACTO  NOT LIKE '' 
           ) Z

Add a code snippet to your website: www.paste.org