Numeric or Alphanumeric datatype [message #162875] |
Mon, 13 March 2006 23:35 |
gajini
Messages: 262 Registered: January 2006
|
Senior Member |
|
|
Hi,
In a table,I've a column named EMPID,now i wants to say making EMPID as Numeric datatype has more advantage than making it as Alphanumeric datatype.I've studied somewhere,there will be improvement in performance by using Numeric type than Alphanumeric type,thats why i'm asking it.
What are the possible reasons can i say for it?
Please anyone help me in clearing this doubt.
Thanks,
Malru
|
|
|
Re: Numeric or Alphanumeric datatype [message #162918 is a reply to message #162875] |
Tue, 14 March 2006 02:32 |
rleishman
Messages: 3728 Registered: October 2005 Location: Melbourne, Australia
|
Senior Member |
|
|
A numeric datatype will generally take a little less space than the text equivalent in a VARCHAR2 data type.
Otherwise, the advantages are:
- You can disallow non-numeric values
- You can perform arithmetic or SUM()/AVG() functions without casting to a number.
Disadvantages are:
- You can only store integers up to about 38 significant digits. Varchar2 can store several thousand digits.
That's about all I can think of. It's not a big performance consideration. Index scans and comparison operations are not noticibly faster. Unless you were scanning several million rows, the space saving of NUMBER over VARCHAR2 would not translate into a considerable I/O saving.
_____________
Ross Leishman
|
|
|