Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

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:
  #1  
Old April 11th, 2005, 03:24 AM
cherry1 cherry1 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 15 cherry1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 21 m
Reputation Power: 0
trouble with number(p,s) data type.

hi!
im using oracle8 and im having trouble using the number() data type. i just cant make sense of vat im doing wrong. can anyone explain vat p and s (precision and scale...as it says in my book) mean in number(p,s) data type?

suppose i have a column GPA. i need 1 digit before the decimal point and (say) 2 digit after the decimal point (for extra precision) because GPA cannot have higher value than 4.0
ie gpa number(1,2) then inserting value 3.45 gives this msg:
ORA-01438: value larger than specified precision allows for this column

so i alter the table: gpa number(2,1)
now that i insert 3.45, it rounds it off to 3.5, WHY?

so just to give it a try, i insert value 4.32 in gpa (not a valid GPA...but anyway) and upon selecting...it give 4.3
WHAT IS GOING ON HERE? can anyone explain plz?

also, can anyone plz tell me what are the maximum number of columns i can create in one table?

Reply With Quote
  #2  
Old April 11th, 2005, 05:02 AM
shammat shammat is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Oct 2003
Location: Munich, Bavaria
Posts: 1,009 shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level)shammat User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 14 h 3 m 17 sec
Reputation Power: 67
According to

http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/sql_elements2a.htm#45723

You should use number(3,2)

Quote:
also, can anyone plz tell me what are the maximum number of columns i can create in one table?
I don't know the limit (but I'm sure that it's in the docs somewhere, most probably the concept or reference guide).
But anyway, I never reached this limit, the table with the highest number of columns I have seen was something like 50-60 columns, but that was poor DB design anyway (and I can't think of any example were having more then 50 columns would make sens)

Reply With Quote
  #3  
Old April 12th, 2005, 01:48 AM
cherry1 cherry1 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 15 cherry1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 21 m
Reputation Power: 0
thanx shammat!! its all clear now!

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > trouble with number(p,s) data type.


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 6 hosted by Hostway
Stay green...Green IT