Received: from mx99.openu.ac.il (arbel.openu.ac.il [147.233.32.4]) by hub.org (8.9.3/8.9.3) with ESMTP id HAA82696 for ; Wed, 7 Jul 1999 07:57:15 -0400 (EDT) (envelope-from herouth@oumail.openu.ac.il) Received: from talmon.openu.ac.il (talmon.openu.ac.il [147.233.32.11]) by mx99.openu.ac.il (Postfix) with ESMTP for id 1619C4B56D; Wed, 7 Jul 1999 14:57:11 +0300 (IDT) Received: from [147.233.159.109] (mac-herouth.pc.openu.ac.il) by talmon.openu.ac.il (Netscape Messaging Server 3.54) with ESMTP id AAAD96; Wed, 7 Jul 1999 15:00:14 +0300 X-Sender: herouth@shaked.cc.openu.ac.il Message-Id: In-Reply-To: <37824FB0.4BD0714C@kearneydev.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Wed, 7 Jul 1999 14:57:09 +0300 To: secret From: Herouth Maoz Subject: Re: [SQL] Type Conversion: int4 -> Money Cc: pgsql-sql@postgreSQL.org At 21:49 +0300 on 06/07/1999, secret wrote: > Is there a way to convert an int4 into a money? I have a few reports > that require format of int4 as a money(I didn't use money for money > because it's very difficult to convert money into other types it > seems)... What language do you use for creating the report? Most of the time, you can get the integer in the frontend (the report program), and format it using some formatting routine. > The only way I can figure out how to do it is a kludge, such as: > > CREATE TABLE z(a int4, b money); > > Fill a with appropriate values, then set b as "1". SELECT a*b as a FROM > z... And your done... But there should be some easier way to convert an > int4 into a money rather than mulitply it? You can multiply it without creating a special table for it. For example, here is a test table: testing=> select num, num * '1'::money from test1; num|?column? ------+----------- 2|$2.00 4|$4.00 -14|($14.00) 38|$38.00 199|$199.00 100399|$100,399.00 (6 rows) Is that what you wanted? Herouth -- Herouth Maoz, Internet developer. Open University of Israel - Telem project http://telem.openu.ac.il/~herutma