Re: [SQL] Money variable

From: Herouth Maoz <herouth(at)oumail(dot)openu(dot)ac(dot)il>
To: "Duncan Kinder" <dckinder(at)mountain(dot)net>, "Postgres SQL List" <pgsql-sql(at)postgreSQL(dot)org>
Subject: Re: [SQL] Money variable
Date: 1999-10-13 14:23:02
Message-ID: l03130301b42a45bc6736@[147.233.159.109]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Ottawa Online Digital Development 1999-10-13 17:11:12 (no subject)
Previous Message Ismail Kizir 1999-10-13 07:20:34 ERROR: unexpected SELECT query in exec_stmt_execsql()