Cast Type

From: Thirumoorthy Bhuvneswari <tbhuvneswari(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Cast Type
Date: 2002-08-27 09:10:29
Message-ID: 20020827091029.94869.qmail@web13603.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hi,
I am using Postgresql-7.1 on RedHat Linux-7.1. I would
like to know about cast types. I am having a tableA
with two fields cr_amt varchar(15) and dr_amt
varchar(15). I am having about 10000 records so I
could not recreate it. I am having tableB with cr_amt
float8 and dr_amt float8. I want to use 'sum' function
from the tableB.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'. How could I
achieve this. Please help me. thanks.

regards,
T.Bhuvaneswari.

__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Nigel J. Andrews 2002-08-27 09:17:44 Re: how to count string occurrence in column
Previous Message Mario Weilguni 2002-08-27 08:16:14 Re: union and limit