Home » SQL & PL/SQL » SQL & PL/SQL » NUMBER Datatype
NUMBER Datatype [message #214179] Mon, 15 January 2007 05:26 Go to next message
Messages: 35
Registered: March 2006
Location: Bangalore
Hi There,
I'm facing a problem, could anyone help me.
A Table declared with column as NUMBER Datatype, which obvioulsy dropping the zero in second decimal place. Is there any way that i can stop this, without changing the column datatype explicity as NUMBER(12,2) etc.
Maybe any ORACLE Settings etc.
I know one way of doing this is to use TO_CHAR(), apart from this??? any way?
For Ex:
AMT ====>> AMT
---- ---
10.5 ====>> 10.50

Re: NUMBER Datatype [message #214181 is a reply to message #214179] Mon, 15 January 2007 05:31 Go to previous message
Messages: 21040
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
NUMBER(12, 2) will NOT do that either; 10.5 will still be 10.5 (and it should be). If you want to format it accordingly to your needs, you'll have to use TO_CHAR function. Or, while in SQL*Plus, use COLUMN command to format it. Here are the examples:
SQL> create table test (a number(12, 2));

Table created.

SQL> insert into test values (10.50);

1 row created.

SQL> select * From test;

      10.5    --> see? NUMBER(12, 2) doesn't do anything

SQL> column a format 9990.00
SQL> select * From test;


Previous Topic: SQL Querry to return database columns which got updated
Next Topic: Alter teh Indexes
Goto Forum:

Current Time: Sun Mar 26 15:58:30 CDT 2017

Total time taken to generate the page: 0.05589 seconds