Mais uma:
SELECT nm_banco, to_ascii(nm_banco,'LATIN1') , to_ascii('%créd%', 'LATIN1')
from banco ;
Retorna:
"CRÉD. REAL DE MINAS GERAIS";"CRA D. REAL DE MINAS GERAIS";"%crACd%"
por que uma fica 'CRA ' e outra 'crAC' é isso que eu não entendo.
Em 25/03/08, Silfar Goulart <[EMAIL PROTECTED]> escreveu:
>
> Tabela Banco:
>
> "BANCO DO BRASIL CRED"
> "CRÉD. REAL DE MINAS GERAIS"
> "BCN - BCO DE CRÉDITO NACIONAL"
>
>
> SELECT nm_banco from banco where to_ascii(nm_banco,'LATIN1') ilike
> to_ascii('%créd%', 'LATIN1');
> não retorna nada
>
> SELECT nm_banco from banco where to_ascii(nm_banco,'LATIN1') ilike
> to_ascii('%cred%', 'LATIN1');
>
> retorna: "BANCO DO BRASIL CRED"
>
> SELECT nm_banco from banco where to_ascii(nm_banco,'LATIN1') ilike
> '%créd%';
> não retorna nada
>
> SELECT nm_banco from banco where to_ascii(nm_banco,'LATIN1') ilike
> '%cred%';
> retorna: "BANCO DO BRASIL CRED"
>
>
> SELECT * FROM banco WHERE
> to_ascii(convert(nm_banco, 'unicode', 'latin1'), 'latin1') ilike
> to_ascii(convert('%cred%', 'unicode', 'latin1'), 'latin1');
>
> retorna:
>
> ERROR: function convert(character varying, unknown, unknown) does not
> exist
> LINE 2: to_ascii(convert(nm_banco, 'unicode', 'latin1'), 'latin1') i...
> ^
> HINT: No function matches the given name and argument types. You might
> need to add explicit type casts.
>
> ********** Erro **********
>
> ERROR: function convert(character varying, unknown, unknown) does not
> exist
> SQL state: 42883
> Dica: No function matches the given name and argument types. You might
> need to add explicit type casts.
> Caracter: 36
>
>
>
>
>
> Em 24/03/08, Marco Aurélio Carvalho Feitosa <[EMAIL PROTECTED]> escreveu:
> >
> > Meus bancos são UTF8 e isso funciona perfeitamente.
> >
> >
> > Silfar Goulart escreveu:
> >
> > De novo, só funciona se o encoding for latin1 ou win1252
> >
> > Em 24/03/08, Marco Aurélio Carvalho Feitosa <[EMAIL PROTECTED]>
> > escreveu:
> > >
> > > Para bancos em UTF8 use
> > >
> > > SELECT nm_banco from banco where to_ascii(nm_banco,'LATIN1') ilike
> > > '%cred%';
> > >
> > >
> > > []'s
> > >
> > > Marco Aurélio C Feitosa
> > >
> > >
> > > Silfar Goulart escreveu:
> > >
> > > Sim Dickson, mas isso só funciona se o banco estiver em latin se ele
> > > estiver em utf8 nao rola:
> > >
> > >
> > > SELECT nm_banco from banco where to_ascii(nm_banco) ilike '%cred%';
> > >
> > > ERROR: encoding conversion from UTF8 to ASCII not supported
> > >
> > > 2008/3/24, Dickson Guedes <[EMAIL PROTECTED]>:
> > > >
> > > > Silfar Goulart escreveu:
> > > >
> > > > > Bom gente já tentei de tudo, esta é a minha ultima tentativa.
> > > > Preciso
> > > > > fazer um select que me retorne uma consulta que ignore acentos
> > > > tipo
> > > > >
> > > > > se eu buscar por jose tem que vir josé, jose etc...
> > > > >
> > > > > Alguem sabe com eu faço isso ?
> > > >
> > > >
> > > > local=# SELECT nome from pessoa where to_ascii(nome) ilike '%jose%';
> > > > nome
> > > > ---------------------
> > > > Antonia Josefina
> > > > José Silveira
> > > > José da Silva Sauro
> > > > (3 registros)
> > > >
> > > >
> > > >
> > > > []s
> > > >
> > > > Guedes
> > > >
> > > > _______________________________________________
> > > > pgbr-geral mailing list
> > > > [email protected]
> > > > https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral
> > > >
> > >
> > >
> > >
> > > --
> > > Silfar Goulart
> > >
> > > ------------------------------
> > >
> > > _______________________________________________
> > > pgbr-geral mailing list
> > > [email protected]
> > >
> > >
> > > https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > pgbr-geral mailing list
> > > [email protected]
> > > https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral
> > >
> > >
> >
> >
> > --
> > Silfar Goulart
> >
> > ------------------------------
> >
> > _______________________________________________
> > pgbr-geral mailing list
> > [email protected]
> >
> > https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral
> >
> >
> >
> > _______________________________________________
> > pgbr-geral mailing list
> > [email protected]
> > https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral
> >
> >
>
>
> --
> Silfar Goulart
>
--
Silfar Goulart
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral