Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Storing numbers starting with zero

PeaceMongerNov 18 2016 — edited Nov 18 2016

DB version:11.2.0.4

I always advise application developers to use NUMBER data type if you are going to store number in that column.

But, I have a requirement to store numbers starting with 0. I just discovered that oracle trims/removes any 'number' that starts with a zero .

Changing the column data type to VARCHAR2 will work. So, is this standard workaround when you want to store numbers starting with zero ?

SQL> create table t1 (col1 number);

Table created.

SQL> insert into t1 values (0383838);

1 row created.

SQL> commit;

Commit complete.

SQL> select * from t1;

      COL1

----------

    383838

This post has been answered by Frank Kulash on Nov 18 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 16 2016
Added on Nov 18 2016
5 comments
4,553 views