Silfar Goulart de Castro escreveu:
>>>> Qual o resultado de:
>>>> SELECT ID_TITULAR , NM_TITULAR, SIGLA_SOC, TP_PESSOA
>>>> FROM TITULAR T
>>>> WHERE (to_ascii(convert(t.nm_titular, 'LATIN1'), 'LATIN1') =
>>>> to_ascii(convert(:par, 'LATIN1'), 'LATIN1'))
>>>> ORDER BY NM_TITULAR;
>
> SELECT ID_TITULAR , NM_TITULAR, SIGLA_SOC, TP_PESSOA
> FROM TITULAR T
> WHERE (to_ascii(convert(t.nm_titular, 'LATIN1'), 'LATIN1') =
> to_ascii(convert('Sérgio', 'LATIN1'), 'LATIN1'))
> ORDER BY NM_TITULAR;
>
>
> ERROR: function convert(character varying, unknown) does not exist
> LINE 3: WHERE (to_ascii(convert(t.nm_titular, 'LATIN1'), 'LATIN1') ...
> ^
> HINT: No function matches the given name and argument types. You might need
> to add explicit type casts.
>
Não sei qual versão você está utilizando.
Na versão 8.2 o comando "\df+ convert" do psql informa:
Lista de funções
Esquema = pg_catalog
Nome = convert
Tipo de dado do resultado = text
Tipos de dado do argumento = text, name
Dono = postgres
Linguagem = internal
Código fonte = pg_convert
Descrição = convert string with specified destination encoding name
e aqui funciona (o banco está em UTF8):
bdteste=# SELECT *
bdteste-# FROM pessoa
bdteste-# WHERE (to_ascii(convert(nome, 'LATIN1'), 'LATIN1') =
bdteste(# to_ascii(convert('Cia Consórcio', 'LATIN1'), 'LATIN1'))
bdteste-# ;
id_pessoa | nome
-----------+---------------
3 | Cia Consórcio
(1 registro)
Osvaldo
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral