pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedMoney variable
2+ messages / 2 participants
[nested] [flat]
* Money variable
@ 1999-10-12 22:29 Duncan Kinder <dckinder@mountain.net>
0 siblings, 1 reply; 2+ messages in thread
From: Duncan Kinder @ 1999-10-12 22:29 UTC (permalink / raw)
To: pgsql-sql
I am attempting to enter values for a database used by the book "The
Practical SQL Handbook," (Bowman, et.al, Addison-Wesley, 1996).
This book, using SQL Anywhere, uses a "bookbiz" database, with a "titles"
table. "Tables" includes, among other things, two fields "price" and
"advance" which use the money variable. I am attempting to enter this data
into Postgres.
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?
Regards,
Duncan C. Kinder
dckinder@mountain.net
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [SQL] Money variable
@ 1999-10-13 14:23 Herouth Maoz <herouth@oumail.openu.ac.il>
parent: Duncan Kinder <dckinder@mountain.net>
0 siblings, 0 replies; 2+ messages in thread
From: Herouth Maoz @ 1999-10-13 14:23 UTC (permalink / raw)
To: Duncan Kinder <dckinder@mountain.net>; 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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~1999-10-13 14:23 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-10-12 22:29 Money variable Duncan Kinder <dckinder@mountain.net>
1999-10-13 14:23 ` Herouth Maoz <herouth@oumail.openu.ac.il>
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