Re: Converting VARCHAR to DECIMAL or NUMERIC

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Juan Francisco Diaz <j-diaz(at)publicar(dot)com>
Cc: <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Converting VARCHAR to DECIMAL or NUMERIC
Date: 2003-08-26 06:00:12
Message-ID: 20030825225737.L16064-100000@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Mon, 25 Aug 2003, Juan Francisco Diaz wrote:

> The subject says it all... How can that be done? I tried to do an explicit
> cast but... Id dint work.

I think currently you'll need to convert to text first, so something like:
cast(cast(varcharcol as text) as numeric) because there's no
varchar->numeric direct cast (although I'm not sure if an explicit cast
would be bad for those cases that text has currently that varchar doesn't)

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Stephan Szabo 2003-08-26 06:03:12 Re: INSERT INTO foo (col1,col2,...,coln) not working
Previous Message Juan Francisco Diaz 2003-08-25 23:37:59 Converting VARCHAR to DECIMAL or NUMERIC