From: | "Oliver Elphick" <olly(at)lfix(dot)co(dot)uk> |
---|---|
To: | "Huy Do" <huy(at)travel(dot)com(dot)au> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Numeric Data Type |
Date: | 2000-12-20 00:29:03 |
Message-ID: | 200012200029.eBK0T6P01048@linda.lfix.co.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
"Huy Do" wrote:
>Hi,
>
>Can anyone give me an explanation of the numeric field.
>
>for eg.
>
>does numeric(2,1) mean a number with 2 digits before the decimal point
>and 1 after (22.1),
>
>or does it mean a number with a maximum of 2 digits and at least
>1 of those digits have to be after the decimal point (2.1)
junk=# create table xx (n numeric(2,1));
CREATE
junk=# insert into xx values (2.1);
INSERT 6705225 1
junk=# insert into xx values (22.1);
ERROR: overflow on numeric ABS(value) >= 10^1 for field with precision 2 scale 1
junk=# insert into xx values (22);
ERROR: overflow on numeric ABS(value) >= 10^1 for field with precision 2 scale 1
junk=# insert into xx values (.22);
INSERT 6705226 1
junk=# insert into xx values (.222);
INSERT 6705227 1
junk=# select * from xx;
n
-----
2.1
0.2
0.2
(3 rows)
--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"And the angel said to her, " Do not be afraid, Mary;
for you have found favor with God. And behold, you
will conceive in your womb, and bear a son, and you
shall name Him Jesus." Luke 1:30,31
From | Date | Subject | |
---|---|---|---|
Next Message | Alejandro Fernandez | 2000-12-20 03:18:08 | Re: web interface for postgreSQL-P.S. |
Previous Message | Poul Kristensen | 2000-12-19 20:26:21 | Sv: Database formats |