Skip site navigation (1) Skip section navigation (2)

Re: CAST and timestamp

From: Keith Worthington <KeithW(at)NarrowPathInc(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: CAST and timestamp
Date: 2004-12-21 03:48:43
Message-ID: 41C79D1B.5020104@NarrowPathInc.com (view raw or flat)
Thread:
Lists: pgsql-novice
Tom Lane wrote:

>"Keith Worthington" <keithw(at)narrowpathinc(dot)com> writes:
>  
>
>>IPADB=# SELECT CAST(scan_date || scan_time AS timestamp) AS datetime_timestamp
>>FROM data_transfer.tbl_inventory_scanner;
>>ERROR:  Cannot cast type character to timestamp without time zone
>>    
>>
>
>  
>
>>IPADB=# SELECT employee_id, item_id, CAST(quantity AS float4) AS quantity FROM
>>data_transfer.tbl_inventory_scanner;
>>ERROR:  Cannot cast type character varying to real
>>    
>>
>
>Try casting the inputs to type "text" and then to timestamp or real.
>
>			regards, tom lane
>
>---------------------------(end of broadcast)---------------------------
>TIP 8: explain analyze is your friend
>
Tom,

Are you saying that I should try something like

CAST( CAST( quantity AS text ) AS float4) AS quantity

-- 
Kind Regards,
Keith


In response to

Responses

pgsql-novice by date

Next:From: Tom LaneDate: 2004-12-21 04:02:37
Subject: Re: CAST and timestamp
Previous:From: Tom LaneDate: 2004-12-21 03:45:26
Subject: Re: Inheritance

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group