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: Sted Alana <Sted_Alana_at_hotmail.com>
Date: Tue, 23 Apr 2002 14:54:40 GMT
Message-ID: <3cc5746c_1@news.iprimus.com.au>

> Sted, You bring up an interesting point. I have never considered
> this point having thought that since Oracle documentation has
> described the PK as being equivilent to a 'not null' constraint + a
> unique key constraint that Oracle explicitly created a 'not null'
> constraint on columns that make up a PK when the PK constarint was
> declared if one was not present. But the following SQL (ran on
> 8.1.7.2) shows Oracle does not do this as no such constraint appears
> in dba_constraints for the 'not null' when implicitly declared. So
> the question for someone with indept knowledge becomes is that any
> performance impact one way or the other.
>
> Personally I like the explict constraint as it ensures that the column
> will always have a value in the event the PK is disabled for
> maintenance of some type and not re-enabled, but if there is a
> performance impact to explicitly declaring the constraint I would
> reconsider this position. Also I like to determine the requirement
> that columns hold data independent of and prior to determining which
> columns will be the PK and will be indexed since this helps determine
> if the developers got the design right to being with.

Sorry, my English is not very good.

Did you try inserting a null value into the primary key without explicitly declaring a not null constraint (i.e. by just using a PK) ? UT1> @ora/obj/cons_tbl
Enter value for table_name: marktest

CONSTRAINT_NAME C SEARCH_CONDITION STATUS

------------------------------ - ------------------------------

MARKTEST_PK P
ENABLED Although the not null contraint is not listed when you do the above, the primary key may act as a not null + unique constraint as stated by oracle.

Firstly, im not sure why there is a need to disable a PK for maintenance. Secondly, I assume there may be a performance issue as explicitly declaring a not null contraint gives an overall "double-check" for the presence of null values. Received on Tue Apr 23 2002 - 09:54:40 CDT

Original text of this message

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