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

Re: Invalid input syntax for integer

From: "Jean-Yves F(dot) Barbier" <12ukwn(at)gmail(dot)com>
To: Hans Edwin Winzeler <hewinzeler(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Invalid input syntax for integer
Date: 2011-08-18 15:43:04
Message-ID: 20110818174304.6b0cb977@anubis.defcon1 (view raw or flat)
Thread:
Lists: pgsql-novice
On Thu, 18 Aug 2011 11:07:58 -0400, Hans Edwin Winzeler <hewinzeler(at)gmail(dot)com>
wrote:

Oops, forgot this one:

>    - How do I convert the varchar(20) that I have already imported into a
>    numeric value?

you need to:
* add a real/float/numeric/... wanted column to the table,
* use a function that:
     read a row,
     get the varchar(20) column,
     check for beginning with 0-[1-9],
     strip '0-' from the string,
     convert it into the wanted format,
     update table's real/float/numeric/... column with the result,
     loop until end of table.

-- 
Reality is for people who can't deal with drugs.
		-- Lily Tomlin

In response to

pgsql-novice by date

Next:From: Tom LaneDate: 2011-08-18 15:55:01
Subject: Re: Invalid input syntax for integer
Previous:From: Jean-Yves F. BarbierDate: 2011-08-18 15:32:05
Subject: Re: Invalid input syntax for integer

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