Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: flag
hmmm Flag....Randall Flagg...walkin' dude.....
I would take a STAND and say that since computers are essentially doing
mathematic operations NUMBER(1)
would be a single digit integer with values of O or 1 is what I would use
for flag field in Oracle. If it is going to be exposed to users then it
might be better to use a CHAR(1) with Y or N as values as sometimes human
legible data is more important than the minute perfromance gains in coding
things with numbers. (that is why they created character datatypes...people
aren't computers...at least not yet anyway)
Data integrity too...using numbers mean some yahoo can't enter a "B" and screw things up. Nothing I hate more than mixed datatypes and non-atomic data in fields...always seems to cause problems later. YOu put a B in there then the next thing someone wants to add more room to put words...words! Can't have those things in a database. Has to be obsfucated codes, bizzarre vodoo serial numbers, illegible dates, bad abbreviations, hyphens, under_scores, HEX...anything but words...
When a CHAR is compared to CHAR say with: WHERE flag = 'Y' there is still somekind of conversion into a numeric representation of the 'Y'. At one time this converstion was probably costly but the speed of modern CPUs and cheap disk space (compared to ten years ago) makes the significance of the gains using one datatype over another less evident. (barring clobs, lobs, blobs and other slobs and bizzare binary datatypes)
I have even seen using VARCHAR2(1) as the flag. I know...it seemed silly to me when I saw it but it was done for the sake of consistency during modeling. All characters were VARCHAR2 and all numbers were catagorized with NUMBER and appropriate precisions for types of numbers, currency, interest rates, percentages etc...standards what a concept...someone said once that CHAR may someday go away when VARCHARs came around, that was several years ago...its still here.
have fun
Brad O.
-----Original Message-----
Sent: Wednesday, May 21, 2003 3:17 PM
To: Multiple recipients of list ORACLE-L
Would you use a number or char for a flag in a table? Would you use a char since it's one byte and a number is 22 bytes?
Dave
--
Please see the official ORACLE-L FAQ: http://www.orafaq.net
--
Author: David Turner
INET: turner_at_tellme.com
Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services ---------------------------------------------------------------------To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services ---------------------------------------------------------------------To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Wed May 21 2003 - 16:48:18 CDT