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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: oracle not null question

RE: oracle not null question

From: Hamid Alavi <HamidA_at_aimdirect.co.nz>
Date: Wed, 18 Oct 2000 09:14:49 +1300
Message-Id: <10652.119542@fatcity.com>


Hi,
The diffrence is when you put NOT NULL oracle create a check against that column and you can not add manulay add not null check so for not null you have to define it during the table creation. hope it helps

-----Original Message-----
From: John Dunn [mailto:john.dunn_at_sefas.co.uk] Sent: Wednesday, 18 October 2000 03:32
To: Multiple recipients of list ORACLE-L Subject: oracle not null question

> We've used the Oracle Schema Manager to create tables for us, and the SQL
> it has used is e.g. ...
>
> CREATE TABLE
> JOBS
> (JOBSKEY NUMBER(4,0) NOT NULL,
> DOCUMENT_TYPE VARCHAR2(20) NOT NULL,
> JOB_RECEIVED_DATE DATE NOT NULL,
> DESCRIPTION VARCHAR2(250) NOT NULL,
> FILE_SIZE NUMBER(12,0) NOT NULL,
> NUMBER_OF_DOCUMENTS NUMBER(9,0) NULL,
> NUMBER_OF_PAGES NUMBER(9,0) NULL,
> CHECK (JOBSKEY IS NOT NULL),
> CHECK (DOCUMENT_TYPE IS NOT NULL),
> CHECK (JOB_RECEIVED_DATE IS NOT NULL),
> CHECK (DESCRIPTION IS NOT NULL),
> CHECK (FILE_SIZE IS NOT NULL),
> PRIMARY KEY (JOBSKEY))
> PCTFREE 20 PCTUSED 60 INITRANS 2 MAXTRANS 255 STORAGE ( INITIAL 24K NEXT
> 44K MINEXTENTS 1 MAXEXTENTS 249 PCTINCREASE 0)
> TABLESPACE "USERS";
>
> The question is, what is the difference between putting NOT NULL by each
> field definition in the table, and the CHECK condition (apparently) doing
> the same thing?
>
> Also, doesn't setting the Primary Key to JOBSKEY imply that it cannot be
> NULL anyway?

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: John Dunn
  INET: john.dunn_at_sefas.co.uk

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
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 Tue Oct 17 2000 - 15:14:49 CDT

Original text of this message

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