Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: minimum space taken by null varchar2 ?

Re: minimum space taken by null varchar2 ?

From: Brian Peasland <peasland_at_edcmail.cr.usgs.gov>
Date: 2000/06/22
Message-ID: <39521D38.1C8F8620@edcmail.cr.usgs.gov>#1/1

> As far as I know:
> NULL is not saved in the database, so it doesn't take any space in
> this situation.
> The existence of the column takes 1 byte/row.

To show that the NULL does not take up any space, use the VSIZE function. For example:

SQL> create table testnull (
  2 id varchar2(20));

Table created.

SQL> insert into testnull values ('1');

1 row created.

SQL> insert into testnull values (NULL);

1 row created.

SQL> insert into testnull values ('1234');

1 row created.

SQL> select id,vsize(id) from testnull;

ID                    VSIZE(ID)
-------------------- ----------
1                             1

1234                          4

SQL> The VSIZE function shows the storage size of the value. It's interesting to note that the column with the NULL value has no size (but doesn't say '0'). Anyway, I do agree that even though there is no storage required to hold a NULL value, there is some storage to denote the column (empty or not).

HTH,
Brian

-- 
========================================
Brian Peasland
Raytheons Systems at
  USGS EROS Data Center
These opinions are my own and do not
necessarily reflect the opinions of my 
company!
========================================
Received on Thu Jun 22 2000 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US