Thread: to_char()??

to_char()??

From
"guard"
Date:
dear sir

how to
select substr('hi there',3,5) as xx   -->>  xx change char type

thanks

--





Re: to_char()??

From
"guard"
Date:
thanks

I have run "select substr('hi there', 3, 5)::varchar(5) as xx;"
but get error message
Error: ERROR:  parser: parse error at or near ":"

--

"Lee Harr" <missive@frontiernet.net> ���g���l���s�D
:9qd0j0$1gc3$1@news.tht.net...
> >
> > how to
> > select substr('hi there',3,5) as xx   -->>  xx change char type
> >
>
> How about:
>
> select substr('hi there', 3, 5)::varchar(5) as xx;
>
> or is this not what you mean?
>




Re: to_char()??

From
missive@frontiernet.net (Lee Harr)
Date:
> 
> how to
> select substr('hi there',3,5) as xx   -->>  xx change char type
> 

How about:

select substr('hi there', 3, 5)::varchar(5) as xx;

or is this not what you mean?



Re: to_char()??

From
"Ross J. Reedstrom"
Date:
On Mon, Oct 15, 2001 at 09:56:26AM +0800, guard wrote:
> thanks
> 
> I have run "select substr('hi there', 3, 5)::varchar(5) as xx;"
> but get error message
> Error: ERROR:  parser: parse error at or near ":"

Upgrade your version of PostgreSQL:

test=# select substr('hi there', 3, 5)::varchar(5) as xx; xx   
------- ther
(1 row)

test=# select version();                           version                            
---------------------------------------------------------------PostgreSQL 7.1.2 on i686-pc-linux-gnu, compiled by GCC
2.95.4
(1 row)

test=# 

Ross
-- 
Ross Reedstrom, Ph.D.                                 reedstrm@rice.edu
Executive Director                                  phone: 713-348-6166
Gulf Coast Consortium for Bioinformatics              fax: 713-348-6182
Rice University MS-39
Houston, TX 77005


Re: to_char()??

From
missive@frontiernet.net (Lee Harr)
Date:
On Mon, 15 Oct 2001 09:56:26 +0800, guard <guard@ficnet.net> wrote:
> thanks
> 
> I have run "select substr('hi there', 3, 5)::varchar(5) as xx;"
> but get error message
> Error: ERROR:  parser: parse error at or near ":"
> 

Works for me on 7.1.2 and pre-7.2
What version are you using?

select version();

That still leaves it unclear in my mind what exactly you want
from your query.




Re: to_char()??

From
Szabo Zoltan
Date:
Try: ::text

CoL

guard wrote:

> thanks
> 
> I have run "select substr('hi there', 3, 5)::varchar(5) as xx;"
> but get error message
> Error: ERROR:  parser: parse error at or near ":"
> 
> --
> 
> "Lee Harr" <missive@frontiernet.net> ¼¶¼g©ó¶l¥ó·s»D
> :9qd0j0$1gc3$1@news.tht.net...
> 
>>>how to
>>>select substr('hi there',3,5) as xx   -->>  xx change char type
>>>
>>>
>>How about:
>>
>>select substr('hi there', 3, 5)::varchar(5) as xx;
>>
>>or is this not what you mean?
>>
>>
> 
> 



Re: to_char()?? Works for me.

From
Christopher Sawtell
Date:
Works for me.

chris=# select substr('hi there', 3, 5)::varchar(5) as xx; xx
------- ther
(1 row)

chris=# select version();                          version
-------------------------------------------------------------PostgreSQL 7.1.2 on i686-pc-linux-gnu, compiled by GCC
2.96
(1 row)

On Mon, 15 Oct 2001 14:56, guard wrote:
> thanks
>
> I have run "select substr('hi there', 3, 5)::varchar(5) as xx;"
> but get error message
> Error: ERROR:  parser: parse error at or near ":"