X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 05BC2529C8 for ; Fri, 22 Jul 2005 14:29:27 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57144-05 for ; Fri, 22 Jul 2005 17:29:23 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id 981FF529BF for ; Fri, 22 Jul 2005 14:29:22 -0300 (ADT) Received: (qmail 30241 invoked by uid 500); 22 Jul 2005 17:30:14 -0000 Date: Fri, 22 Jul 2005 12:30:14 -0500 From: Bruno Wolff III To: lucas@presserv.org Cc: pgsql-sql@postgresql.org Subject: Re: Convert numeric to money Message-ID: <20050722173014.GB29782@wolff.to> Mail-Followup-To: Bruno Wolff III , lucas@presserv.org, pgsql-sql@postgresql.org References: <20050722110340.4ogyzmonnny800sc@www.presserv.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050722110340.4ogyzmonnny800sc@www.presserv.org> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200507/195 X-Sequence-Number: 22173 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.