Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: SQL*Plus - PK Question
Mad and bad developers I would suggest. (Is that a tautology?)
There is not an Earthly reason why you would need or want to declare both a not null constraint AND a Primary Key constraint. Precisely because, as you say, PK implies Not Null.
Where are all these examples you keep coming across?
It's not because you DESC a table is it? You'll find that describing a table in SQL Plus means that the Primary Key column(s) is/are shown to be Not Null. That's as good as it gets in SQL Plus: the fact that columns have other constraints coming out of their ears is not visible or evident, short of having a look at DBA_CONSTRAINTS.
Therefore, don't panic about it if this is the problem: just consider it a minor niggle with the software. And don't start thinking you're not spot on about Primary Keys: you are... they DO imply not null.
Regards
HJR
"Sted Alana" <Sted_Alana_at_hotmail.com> wrote in message
news:3cc506ff_1_at_news.iprimus.com.au...
> I have come across many examples in sql*plus with regards to using 'not
> nulls' in conjunction with primarys keys. This bothers me because from my
> reading when a primary key is defined for an attributes(s) of a table, it
> assumes that those values cannot contain null values, but yet i see this:
>
> create table Example
> (
> sid char(5) not null,
> ....
> constraint pk_sid primary key (sid)
> );
>
> why need to use not null when primary key implicitly imposes that
contraint?
>
> Any help appreciated.
>
>
>
>
Received on Tue Apr 23 2002 - 02:40:48 CDT