Re: to_char function
От | Karel Zak |
---|---|
Тема | Re: to_char function |
Дата | |
Msg-id | Pine.LNX.3.96.1001019081522.24158C-100000@ara.zf.jcu.cz обсуждение исходный текст |
Ответ на | Re: to_char function (YekFu.Wong@seagate.com) |
Список | pgsql-general |
On Thu, 19 Oct 2000 YekFu.Wong@seagate.com wrote: > In case you want to convert from int to string and reversely, try > > $var1 = 5000; > $var2 = sprintf ("%s", $var1); # $var2 become string > $var3 = int ($var2); # $var3 become int I don't understand, what do you want. The to_char() is for date/time and number *formatting* like: test=# select to_char(5000.123, '"I love number:" 9 9 9 9 . 999'); to_char ------------------------------- I love number: 5 0 0 0 . 123 (1 row) but you probably mean *cast* number to string, for this use SQL, '::' operator or CAST() function: test=# select 5000::text, CAST(5000 AS text); ?column? | ?column? ----------+---------- 5000 | 5000 (1 row) .. but don't forget, to your application go answers as strings/binary data only, a standard frontend lib don't cast to some type. The cast in query is used for internal backend processes only. Karel > Karel Zak <zakkr@zf.jcu.cz>@hub.org on 10/19/2000 06:46:08 AM > > On Wed, 18 Oct 2000, Yohans Mendoza wrote: > > > hi all, > > > > where can I find info about the function to_char > > Oh man.. Do you know how much hardly is for non-English person like me > write a good documentation? And you can't found it. :-) > > Where.. in the PostgreSQL docs (for 7.0 or 7.1devel) of course. > (See "formatting function"..) > > Karel
В списке pgsql-general по дате отправления: