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 5CAAC52C3A for ; Mon, 25 Jul 2005 04:58:33 -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 08392-07 for ; Mon, 25 Jul 2005 07:58:27 +0000 (GMT) Received: from resmta04.ono.com (smtp.ono.com [62.42.230.12]) by svr1.postgresql.org (Postfix) with ESMTP id 2CDCB52C2F for ; Mon, 25 Jul 2005 04:58:26 -0300 (ADT) Received: from Zeus (84.120.7.0) by resmta04.ono.com (7.2.052) id 424AAD63009A708A for pgsql-sql@postgresql.org; Mon, 25 Jul 2005 09:58:26 +0200 From: "Mauricio Fernandez" To: Subject: Re: Convert numeric to money Date: Mon, 25 Jul 2005 09:59:05 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 In-Reply-To: <20050722173014.GB29782@wolff.to> Importance: Normal X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.312 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST X-Spam-Level: * X-Archive-Number: 200507/218 X-Sequence-Number: 22196 inspect your cast functions with: create view showcasts as select t.typname as source, t1.typname as target, p.proname as function, (select case when c.castcontext = 'e' then 'Must use Explicit Cast' else ( select case when c.castcontext = 'i' then 'Implicit cast for expressions and assignments' else 'Implicit cast only for assignments' end) end ) as casttype from pg_cast c, pg_type t, pg_type t1, pg_proc p where c.castsource = t.oid and c.casttarget = t1.oid and c.castfunc = p.oid; Un saludo. Mauricio Fernandez A. Ingeniero de Sistemas Universidad Autonoma de Manizales mfacontacto@ono.com -----Mensaje original----- De: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org]En nombre de Bruno Wolff III Enviado el: viernes, 22 de julio de 2005 19:30 Para: lucas@presserv.org CC: pgsql-sql@postgresql.org Asunto: Re: [SQL] Convert numeric to money 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. ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq