pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Herouth Maoz <herouth@oumail.openu.ac.il>
To: Duncan Kinder <dckinder@mountain.net>
To: Postgres SQL List <pgsql-sql@postgreSQL.org>
Subject: Re: [SQL] Money variable
Date: Wed, 13 Oct 1999 16:23:02 +0200
Message-ID: <l03130301b42a45bc6736@[147.233.159.109]> (raw)
In-Reply-To: <07ff01bf1501$62342b80$02010101@duncan>

At 00:29 +0200 on 13/10/1999, Duncan Kinder wrote:


> I cannot enter data into these fields in Postgres.   When entering "$20.00"
> for price I get the following:  "error near '.00'.  When entering "$20" I
> get "out of range." and when entering "20.00" I get " attribute 'price' is
> of type'money' but expression is of type 'float8'.  You will have to rewrite
> or cast the expression.
>
> I have drooped and re-created the table.  I have attempted to enter this
> data numerous times.  No luck.
>
> How do I enter money data in Postgres?

Money is not recommended (deprecated). The recommended method is to use
NUMERIC with a two-digit precision (or three, in countries where relevant,
which is exactly why this recommendation was made).

But if you insist on using money for the sake of the example, you should
put the values in single quotes, like strings:

INSERT INTO money_table (money_field) VALUES ('20.00');

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma





view thread (2+ messages)

Message-ID: <l03130301b42a45bc6736@[147.233.159.109]>
Permalink:  ../l03130301b42a45bc6736@%5B147.233.159.109%5D/
Also on:    postgresql.org/message-id/l03130301b42a45bc6736@[147.233.159.109]

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: herouth@oumail.openu.ac.il, dckinder@mountain.net
  Subject: Re: [SQL] Money variable
  In-Reply-To: <l03130301b42a45bc6736@[147.233.159.109]>
  References: <07ff01bf1501$62342b80$02010101@duncan> <l03130301b42a45bc6736@[147.233.159.109]>

* 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