pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: lucas@presserv.org
Cc: pgsql-sql@postgresql.org
Subject: Re: Convert numeric to money
Date: Fri, 22 Jul 2005 12:30:14 -0500
Message-ID: <20050722173014.GB29782@wolff.to> (raw)
In-Reply-To: <20050722110340.4ogyzmonnny800sc@www.presserv.org>
References: <20050722110340.4ogyzmonnny800sc@www.presserv.org>

On Fri, Jul 22, 2005 at 11:03:40 -0300,
  lucas@presserv.org wrote:
> Hi.
> I have searched in mailing-list archives about converting types, but I couldn't
> found a function or clause that convert a numeric type to money type.
> How Can I convert this types?
> 
> => select '1234'::money;
>    money
> ------------
>  R$1.234,00
> 
> => select '1234'::numeric::money;
> ERROR:  cannot cast type numeric to money
> 
> The problem is becouse I have a table with "numeric" field, and I need to show
> it like "money" type (R$ 1.234,00). Is there a function to convert it??? Or is
> there a function to mask the numeric field to show like money (with
> R$x.xxx,xx)???

You probably want to use to_char to convert the numeric value to a string
which can be displayed.



view thread (4+ messages)  latest in thread

Message-ID: <20050722173014.GB29782@wolff.to>
Permalink:  ../20050722173014.GB29782@wolff.to/
Also on:    postgresql.org/message-id/20050722173014.GB29782@wolff.to

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: bruno@wolff.to, lucas@presserv.org
  Subject: Re: Convert numeric to money
  In-Reply-To: <20050722173014.GB29782@wolff.to>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox