Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: flag
Dave,
I agree with Stephane about Y/N rather than 1/0 - makes it more recognizable by humans in reports - and you don't have to translate a 1 into a Yes at report time.
Worrying about "how much storage space it takes" is just not a valid concern in my mind anymore. It takes what it takes and that's just the way it is.
I'm always more conerned about design issues - like will he field morph into a Y/N/Unknown field in the future, or what is the easiest way for an end-user report-writer to report the field at the end of the day with a simple reporting tool.
Hope this helps.
Tom Mercadante
Oracle Certified Professional
-----Original Message-----
Sent: Wednesday, May 21, 2003 5:48 PM
To: Multiple recipients of list ORACLE-L
David Turner wrote:
>
> 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
Dave,
A number is *at most* 22 bytes
SQL> select vsize(0), vsize(1), vsize('Y'), vsize('N') 2 from dual;
VSIZE(0) VSIZE(1) VSIZE('Y') VSIZE('N') ---------- ---------- ---------- ----------
1 2 1 1
as you can see, the gain is tiny ... especially if NULL values are
acceptable.
As a matter of taste, I'd prefer a char(1) but there is no strong
rationale behind it, just that I find Y/N more understandable than 1/0.
Still a human being :-).
-- Regards, Stephane Faroult Oriole Software -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Stephane Faroult INET: sfaroult_at_oriole.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). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Mercadante, Thomas F INET: NDATFM_at_labor.state.ny.us 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 Thu May 22 2003 - 07:51:47 CDT