Re: How to convert integer to string in functions

Поиск
Список
Период
Сортировка
От David Johnston
Тема Re: How to convert integer to string in functions
Дата
Msg-id CEE8A354-4A76-4271-A932-FB2F996FE997@yahoo.com
обсуждение исходный текст
Ответ на How to convert integer to string in functions  (Siva Palanisamy <siva_p@hcl.com>)
Ответы Re: How to convert integer to string in functions  (Stefan Keller <sfkeller@gmail.com>)
Список pgsql-general

In my table, some of the columns are in text datatype. Few data will come down from UI layer as integers. I want to convert that to string/text before saving it into the table. Please help me on this.


SQL Standard:  "CAST( value AS text )" [or varchar]
PostgreSQL short-hand:  "value::text"

In both formats replace value with whatever you want to convert.  When writing a parameterized  query (using ?) you can write "?::text" ( or Cast(? AS type) ) to explicitly cast the unknown parameter.  The "text" in the above can be any type name.

David J.




В списке pgsql-general по дате отправления:

Предыдущее
От: Siva Palanisamy
Дата:
Сообщение: How to convert integer to string in functions
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: How to convert integer to string in functions