Em 3 de julho de 2012 10:16, Fernanda Forbici
<[email protected]>escreveu:

> Bom dia,
>
> Tenho um campo logradouro, e gostaria de deixar apenas o nome do
> logradouro, tirando os numeros.
>
> select rua from pessoa;
>
>   CELSO EMILIO MULLER 450
>   CURITIBA 128
>   CILON ROSA 267
>   IBICUI 558
>   JZCOB FRANZEN 40
>   BRUNO STISINSKI, 210
>   FLORISBELA FERREIRA  DE LIMA 170
>
> gostaria que retornasse :
>   CELSO EMILIO MULLER
>   CURITIBA
>   CILON ROSA
>   IBICUI
>   JZCOB FRANZEN
>   BRUNO STISINSKI
>   FLORISBELA FERREIRA  DE LIMA
>

Fernanda,

Vc pode fazer uso de expressões regulares no PostgreSQL. Veja o exemplo:


bdteste=# SELECT regexp_replace('CELSO EMILIO MULLER 450', '[0-9]', '',
'g');
    regexp_replace
----------------------
 CELSO EMILIO MULLER
(1 row)


Att,

-- 
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Blog sobre TI: http://fabriziomello.blogspot.com
>> Perfil Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a