[program-l] Re: Primary key in Oracle

  • From: "Jim Pasquale" <j.pasquale@xxxxxxx>
  • To: program-l@xxxxxxxxxxxxx, "program-l@xxxxxxxxxxxxx" <program-l@xxxxxxxxxxxxx>
  • Date: Tue, 27 Oct 2009 01:45:51 +0000

Eileen,
 
The describe command doesn't show primary keys, foreign keys, indexes, etc.  I've attached a script I wrote that shows these features.  It takes the schema name and table name as parameters. 
 
If you want to create a primary key rather than a unique index, the syntax is:
 
ALTER TABLE    making_connections
ADD CONSTRAINT mkgconn_pk
PRIMARY KEY   (first_name, last_name, date_article);
Hope this helps. 
 
Jim Pasquale
 
-------------- Original message from "Lafond, Eileen" <Eileen.Lafond@xxxxxxxxxxx>: --------------


> Hi, I used the following script to create a primary key. I ran it and it said index created. I did a descr on the table and there is nothing to indicate that the key is connected to the table. Is there another step to making the field appear
> in the table?
>
> Script code:
>
> CREATE UNIQUE INDEX MKGCONN_PK ON MAKING_CONNECTIONS
> (FIRST_NAME, LAST_NAME, DATE_ARTICLE);
>
> Thanks for any help,
>
> Eileen La Fond
> work phone: (206) 386-0011
> email: eileen.lafond@xxxxxxxxxxx
> ** To leave the list, click on the immediately-following link:-
> ** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
> ** If this link doesn't work then send a message to:
> ** program-l-request@xxxxxxxxxxxxx
> ** and in the Subject line type
> ** unsubscribe
> ** For other list commands such as vacation mode, click on the
> ** immediately-following link:-
> ** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
> ** or send a message, to
> ** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

Other related posts: