Re: SQL Humor
Date: 23 Aug 2005 09:20:14 -0700
Colin, with SQL Server it might be "pointless" to store a one-byte character in a varchar but it isn't in Oracle and may not be with some other rdbms managers. In Oracle a char(1) and a varchar2(1) both take 2 bytes of internal storage when a value is present. There is a null indicator and the data value for the char column. A length byte and a value for the varchar2. If no value is present, that is the value is said to be null, then the char(1) still takes two physical bytes of storage but the varchar2(1) only requires 1 byte. If the column is at the end of the row then Oracle effectively does not even store the null indicator so the length becomes zero.
HTH -- Mark D Powell -- Received on Tue Aug 23 2005 - 18:20:14 CEST