char vs varchar
A reader, August 06, 2010 - 3:20 pm UTC
Why was char datatype introduced in the first place, if it is of not much use and varchar datatype can serve the same purpose in a better way ?
August 09, 2010 - 12:28 pm UTC
Because we wanted to comply with a standard and the standard said "have char" I suppose.
It is just part of the language.
RE: Why char and varchar
Duke Ganote, August 09, 2010 - 11:29 am UTC
Both CHAR and VARCHAR data types are SQL standard. Oracle's implementation makes VARCHAR2 the generally superior choice. It's what I use.
Some other DBMSs, which are in my opinion inferior or primitive, may perform better using CHAR because they are based on simple, fixed-width files and only begrudgingly accept VARCHAR datatypes.
indexes number(19) vs varchar2(19)
new to oracle, August 26, 2010 - 12:26 am UTC
I am new to oracle and was really surprised to see that there is no difference between number and varchar2 indexes.
I have been working with MySQL, even though is a primitive DB compared to Oracle and PostgreSQL, for the last 10 years and there, they clearly recommend string indexes over number indexes as sorting and searching is more effective on strings than the numbers.
I guess the difference is due to the fact that numbers in Oracle are saved as strings.
August 26, 2010 - 1:26 pm UTC
sorting and searching on strings is more effective (think you mean efficient)????
really - conventional wisdom (and experience) would dictate the opposite be true if anything. Numbers are usually (not in Oracle) stored in a 2 or 4 byte format - which search and sort much easier than a string. The logic is almost always reversed - everyone things NUMBERS are better than STRINGS.
The difference is due to the fact that mysql and Oracle are different databases. sqlserver would be different from both. db2 from all three. and so on. different software = different rules to the game.
Please, don't store numbers in strings.
Shannon Severance, August 26, 2010 - 3:02 pm UTC
U is dead
A reader, March 02, 2015 - 9:58 am UTC
haha !! good one