Storing a number with exactly two decimal places [message #373395] |
Fri, 13 April 2001 13:23 |
tedagem
Messages: 3 Registered: April 2001
|
Junior Member |
|
|
Hello, I need to store a numeric value so that there are always two decimal places. E.g. "31" gets stored as "31.00".
How do I set up my create table statement to ensure that all inserted values are in the correct format?
|
|
|
Re: Storing a number with exactly two decimal places [message #373397 is a reply to message #373395] |
Fri, 13 April 2001 15:42 |
Robert Moy
Messages: 15 Registered: December 2000
|
Junior Member |
|
|
Hello:
You can use this code:
1 create table mywage2 (
2 salary float,
3* name varchar2(20))
SQL> run
1 create table mywage2 (
2 salary float,
3* name varchar2(20))
SQL> insert into mywage2
2 values(4000.00,'Bob');
1 row created.
SQL> insert into mywage2
2 values(5000.01,'Mary');
1 row created.
SQL> select * from mywage2;
SALARY NAME
--------- --------------------
4000 Bob
5000.01 Mary
If you use ".00" it will not show however anything other than zero it will show.
If you need anymore help, please send back a respond
|
|
|