From: | Jeff Eckermann <jeff_eckermann(at)yahoo(dot)com> |
---|---|
To: | "A(dot) Van Hook" <hook(at)kcp(dot)com>, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: casting question |
Date: | 2002-02-04 15:05:30 |
Message-ID: | 20020204150530.43739.qmail@web20810.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Your fields contain spaces, because of the char(15)
datatype padding them out. The numeric conversion
routine can't handle those spaces: you will need to
use a trim function (probably rtrim() will be best) to
take them out.
You can avoid this problem if you use varchar (or
text) instead of char datatype.
--- "A. Van Hook" <hook(at)kcp(dot)com> wrote:
>
>
> I have a column (quantityonhand | character(15)
> | default '' )
> that I would like to use to perform simple math.
> I can't seem to get the syntax for casting and have
> tried various
> combinations of "select
> to_number(quantityonhand::text, '99G999D9S')".
> Can not get get past ERROR: Bad numeric input
> format ' '.
>
>
> Any help would be greatly appreciated....
>
>
> tanks
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
__________________________________________________
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions!
http://auctions.yahoo.com
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2002-02-04 15:47:05 | Re: temporary tables, plpgsql and yes i bet this has been asked before |
Previous Message | Bruce Momjian | 2002-02-04 14:13:54 | Re: temporary tables, plpgsql and yes i bet this has been asked |