pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Eckermann <jeff_eckermann@yahoo.com>
To: A. Van Hook <hook@kcp.com>
To: pgsql-sql@postgresql.org
Subject: Re: casting question
Date: Mon, 4 Feb 2002 07:05:30 -0800 (PST)
Message-ID: <20020204150530.43739.qmail@web20810.mail.yahoo.com> (raw)
In-Reply-To: <3C5C03C6.CAE5CAB3@kcp.com>

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@kcp.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



view thread (3+ messages)

Message-ID: <20020204150530.43739.qmail@web20810.mail.yahoo.com>
Permalink:  ../20020204150530.43739.qmail@web20810.mail.yahoo.com/
Also on:    postgresql.org/message-id/20020204150530.43739.qmail@web20810.mail.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jeff_eckermann@yahoo.com, hook@kcp.com
  Subject: Re: casting question
  In-Reply-To: <20020204150530.43739.qmail@web20810.mail.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox