Re: cast numeric to char

From: Darren Ferguson <darren(at)crystalballinc(dot)com>
To: "Johnson, Shaunn" <SJohnson6(at)bcbsm(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: cast numeric to char
Date: 2002-10-28 14:56:05
Message-ID: Pine.LNX.4.44.0210280955440.24927-100000@thread.crystalballinc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

select number::float::text::char FROM test;

You can cast it a few times as shown above to get there

HTH

On Mon, 28 Oct 2002, Johnson, Shaunn wrote:

> Howdy:
>
> Running PostgreSQL 7.2.1 -
>
> I'm trying to cast a numeric field to character, but I
> am getting errors saying that it can not be done.
>
> [snip errors]
>
> testdb=> select lpad(i_pd::char,7,'0') from t_table limit 1;
> ERROR: Cannot cast type 'numeric' to 'character'
>
> [/snip error]
>
> Is it that I *can not* cast numeric into character value or
> or do I need some new methodology of doing this?
>
> Thanks!
>
> -X
>

--
Darren Ferguson

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Pedro Miguel Frazao Fernandes Ferreira 2002-10-28 14:56:20 Formatting query output
Previous Message Johnson, Shaunn 2002-10-28 14:52:42 cast numeric to char