Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
  #1  
Old October 4th, 2002, 01:48 PM
dreamz dreamz is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2001
Location: Pakistan
Posts: 31 dreamz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dreamz
Question Storing large numbers in oracle

my friend is facing a problem and as i haven't done much work in oracle so thought to post question here.... these are her words:

i have to store a phone number in database and i declared it as "phone number(20,0)", but the problem is that whenever a number having width of more than 15 digits is stored oracle converts the number in exponent and stores so when i retrieve i get first 15 digits correct and after that all 0s. one option is to store phone number as a string but i dun want to do it until n unless its the only way out......so is there ne way of storing the number of size 20 without it being converted to exponent???

Reply With Quote
  #2  
Old October 4th, 2002, 03:01 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 5th Plane (7000 - 7499 posts)
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 7,430 Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 4 Weeks 1 Day 21 h 41 m 55 sec
Reputation Power: 784
Maybe you should try storing it in a CHAR or VARCHAR field instead?

Reply With Quote
  #3  
Old October 4th, 2002, 08:49 PM
hedge hedge is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2002
Posts: 692 hedge User rank is Sergeant (500 - 2000 Reputation Level)hedge User rank is Sergeant (500 - 2000 Reputation Level)hedge User rank is Sergeant (500 - 2000 Reputation Level)hedge User rank is Sergeant (500 - 2000 Reputation Level)hedge User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 4 Days 21 h 22 m 10 sec
Reputation Power: 19
Re: Storing large numbers in oracle

Quote:
Originally posted by dreamz
my friend is facing a problem and as i haven't done much work in oracle so thought to post question here.... these are her words:

i have to store a phone number in database and i declared it as "phone number(20,0)", but the problem is that whenever a number having width of more than 15 digits is stored oracle converts the number in exponent and stores so when i retrieve i get first 15 digits correct and after that all 0s. one option is to store phone number as a string but i dun want to do it until n unless its the only way out......so is there ne way of storing the number of size 20 without it being converted to exponent???


I have done a lot of work with Oracle and I find this VERY hard to believe, it's probably the way it is being formatted when she displays it.

Reply With Quote
  #4  
Old October 6th, 2002, 06:03 PM
merl merl is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 51 merl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 6 m 34 sec
Reputation Power: 6
Uh, I just had a 2 minute play, with this code:

PHP Code:
 SQLcreate table tryx1(
  
2           val NUMBER(30)
  
3  );

Table created.

SQL
SQLinsert into tryx1 (valvalues (12345678901234567890);

1 row created.

SQLselect valto_char(val'99999999999999999999'from tryx1;

       
VAL TO_CHAR(VAL,'99999999
---------- ---------------------
1.2346E+19  12345678901234567890

SQL> 
SQL> drop table tryx1;

Table dropped. 


So it looks like there's no problem with Oracle's handling of large numbers.

Perhaps it's the mechanism you're using to read out the data?

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > Storing large numbers in oracle


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway