typecasting numeric(18,4) to varchar/text

From: "ashok(at)kalculate(dot)com" <ashok(at)kalculate(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: typecasting numeric(18,4) to varchar/text
Date: 2004-05-04 13:35:31
Message-ID: 63340-22004524133531385@M2W046.mail2web.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

hi
how can i typecast a numeric(18,4) value (that i'm extracting from a table)
into a a varchar (which i'll be inserting into another table)
that is:

create table a (a numeric(18,4));
create table b (b varchar(25));
insert into a values(12000.43);
insert into b select (a.a)::varchar;

the above gives the followig error

ERROR: Cannot cast type 'numeric' to 'character varying'

alternately try (this is my real requirement)

insert into b select 'ID'||((a.a)::varchar);

there has been no results on google

thanks in advance
ashok

--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Martin Knipper 2004-05-04 13:42:21 Re: Rank
Previous Message patkins 2004-05-04 13:32:11 Procedure failing after upgrade