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: Table creation problem

Re: Table creation problem

From: M Hashim <m.a.n.hashim_at_sympatico.ca>
Date: Wed, 9 Oct 2002 18:50:13 -0700
Message-ID: <am2p9.27710$da7.172404@news20.bellglobal.com>


Have a look at the definition of Primary Key, and why NULL is NOT allowed. I'll give you a clue - UNIQUE.
then look at this statement;
CONSTRAINT STOCK_PK PRIMARY KEY(SYMBOL, SEQ_NO) "gamaz" <gamaz_at_earthlink.net> wrote in message news:6u%o9.18387$lV3.1768324_at_newsread1.prod.itd.earthlink.net...
> Hi,
> I am trying to create a table where I want only the first two fields to be
> not null values(composite primary key). However, the third row which has a
> datatype 'number' is automatically getting NOT NULL constraint inspite of
> forcing null constraint in the table definition. Is there any way to stop
> this from happening?
> Thanks in advance.
>
> The script I am running is the following:
>
> SQL> create table stock_price (
> 2 SYMBOL VARCHAR2(5) NOT NULL,
> 3 CLOSE_DATE DATE NOT NULL,
> 4 SEQ_NO NUMBER NULL,
> 5 OPEN NUMBER(8,4),
> 6 HI NUMBER(8,4),
> 7 LO NUMBER(8,4),
> 8 CLOSE NUMBER(8,4),
> 9 VOLUME NUMBER(12),
> 10 CONSTRAINT STOCK_PK PRIMARY KEY(SYMBOL, SEQ_NO)
> 11 );
>
> Table created.
>
> SQL> desc stock_price;
> Name Null? Type
> ----------------------------------------- -------- ----------------------

--

> ----
> SYMBOL NOT NULL VARCHAR2(5)
> CLOSE_DATE NOT NULL DATE
> SEQ_NO NOT NULL NUMBER
> OPEN NUMBER(8,4)
> HI NUMBER(8,4)
> LO NUMBER(8,4)
> CLOSE NUMBER(8,4)
> VOLUME NUMBER(12)
>
>
> SQL>
>
>
>
Received on Wed Oct 09 2002 - 20:50:13 CDT

Original text of this message

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