﻿--  select client_telefone, substring(client_telefone,1,2) || '9' || substring(client_telefone,3) as fone_corrigido, * from pbx_cliente where substring(client_telefone,3,1) in ('7','8','9') and length(client_telefone) = 10;
update pbx_cliente set client_telefone = substring(client_telefone,1,2) || '9' || substring(client_telefone,3) where  substring(client_telefone,3,1) in ('7','8','9') and length(client_telefone) = 10;

--  select * into pbx_cliente_bk from pbx_cliente;

--  select client_celular, substring(client_celular,1,2) || '9' || substring(client_celular,3) as fone_corrigido, * from pbx_cliente where substring(client_celular,3,1) in ('7','8','9') and length(client_celular) = 10;
update pbx_cliente set client_celular = substring(client_celular,1,2) || '9' || substring(client_celular,3) where  substring(client_celular,3,1) in ('7','8','9') and length(client_celular) = 10;



--   select * from pbx_campanha;
--  select * from pbx_campanha_contato_fone  where cmp_id = 241 and  substring(conf_fone,3,1) in ('7','8','9') and length(conf_fone) = 10;
update pbx_campanha_contato_fone set conf_fone = substring(conf_fone,1,2) || '9' || substring(conf_fone,3) where  cmp_id = 241 and substring(conf_fone,3,1) in ('7','8','9') and length(conf_fone) = 10;


