Обсуждение: type conversions

Поиск
Список
Период
Сортировка

type conversions

От
Baris Ulu
Дата:
    I created a function that returns a character which is
concatanated with four or five different attributes, but one of them is
float8 that indicates a ratio; but I hava not found a function that
converts a floating point number to a text or char data type.  What can I
do with it(Itried to convert it as in the following 'text(int(ratio))' but
it gives the rounded integer value of my ratio as usual...)



Re: [SQL] type conversions

От
De Moudt Walter
Дата:
Hi Baris,
Think i found something for you. In pg_proc (a table you can and querry
in any postgres database - try "select * from pg_proc) i found the
following :

float4_text accepts float4 returns text
float8_text    float8        text
int2_text    int2        text
int4_text    int4        text
int8_text    int8        text
text_float4    text        float4
text_float8    text        float8
text_int2......    .    .
I think all these functions work with the argument between brackets ()
as any function in (almost) any language, but haven't tested them yet
though.

If You run into problems with fonctions or procedures, you should look
at this table, as well as at the pg_operator table. They are very
instructive, and speak for themselves, with some assumptions :-)

Hope it helps,

regards from Walter De Moudt
(sorry for the sloppy layout, had a drink tonight :-s)

Baris Ulu wrote:
> 
>         I created a function that returns a character which is
> concatanated with four or five different attributes, but one of them is
> float8 that indicates a ratio; but I hava not found a function that
> converts a floating point number to a text or char data type.  What can I
> do with it(Itried to convert it as in the following 'text(int(ratio))' but
> it gives the rounded integer value of my ratio as usual...)
> 
> ************