Re: Cast Type - Mailing list pgsql-general

From Peter Gibbs
Subject Re: Cast Type
Date
Msg-id 000d01c24dae$0ba7f4c0$0b01010a@emkel.co.za
Whole thread Raw
In response to Cast Type  (Thirumoorthy Bhuvneswari <tbhuvneswari@yahoo.com>)
List pgsql-general
Thirumoorthy Bhuvneswari wrote:

> I gave the query as the follows:
> 'insert into tableB select
> (cr_amt::float8),(dr_amt::float8) from tableA;'
> It comes with the error,
> 'Cannot cast type 'varchar' to 'float8'.

There is no function defined as converting directly from
varchar to float8. If you are going to be doing this a lot
you could create a conversion function, otherwise just do:

insert into tableB
  select cr_amt::text::float8, dr_amt::text::float8
  from tableA

--
Peter Gibbs
EmKel Systems


pgsql-general by date:

Previous
From: Lee Kindness
Date:
Subject: Re: how to count string occurrence in column
Next
From: "Jules Alberts"
Date:
Subject: Re: how to count string occurrence in column