Received: from web20810.mail.yahoo.com (web20810.mail.yahoo.com [216.136.226.199]) by postgresql.org (8.11.3/8.11.4) with SMTP id g14F5Ql37479 for ; Mon, 4 Feb 2002 10:05:27 -0500 (EST) (envelope-from jeff_eckermann@yahoo.com) Message-ID: <20020204150530.43739.qmail@web20810.mail.yahoo.com> Received: from [68.11.77.27] by web20810.mail.yahoo.com via HTTP; Mon, 04 Feb 2002 07:05:30 PST Date: Mon, 4 Feb 2002 07:05:30 -0800 (PST) From: Jeff Eckermann Subject: Re: casting question To: "A. Van Hook" , pgsql-sql@postgresql.org In-Reply-To: <3C5C03C6.CAE5CAB3@kcp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Archive-Number: 200202/39 X-Sequence-Number: 6471 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" 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