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: SQL*Plus - PK Question

Re: SQL*Plus - PK Question

From: Stephen B <stephen.bell_at_cgi.ca>
Date: Tue, 23 Apr 2002 13:01:59 -0400
Message-ID: <Eugx8.8059$Bp3.1337369@news20.bellglobal.com>


Hi all,

You asked where they are Howard?
One place I keep running into them and it drives me nuts is when people use certain types of software to extract the DDL from existing tables...as other posters have mentioned a lot of these products don't seem to speak 'Oracle' very well so I found that when I extract the code I see the situation you were describing with a not null constraint and a primary key *sigh*..

But please don't mistake my post as an attempt to defer any kind of blame from the developers where it always belongs :)

"Howard J. Rogers" <dba_at_hjrdba.com> wrote in message news:aa337v$2lc$1_at_lust.ihug.co.nz...
> 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 - 12:01:59 CDT

Original text of this message

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