Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Naming FKs

Re: Naming FKs

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Fri, 28 Aug 1998 14:04:55 GMT
Message-ID: <35e6b8b4.3956899@192.86.155.100>


A copy of this was sent to "Doug Stone" <Doug_Stone_at_compuserve.com> (if that email address didn't require changing) On Thu, 27 Aug 1998 17:35:25 -0700, you wrote:

>Does anyone know if it is possible to name FKs?
>
>All the FKs in my DB are named by Oracle.
>
>Thank you,
>Doug
>

Inline in a create table, it would look like:

create table p ( x int constraint p_pk primary key );

create table c ( x int,

                 constraint c_pk primary key (x),
                 constraint c_fk foreign key (x) references p(x) );


Out of line, as an alter table, it would look like:

create table p ( x int );

alter table p add constraint p_pk primary key(x);

create table c ( x int );

alter table c add constraint c_pk primary key (x); alter table c add constraint c_fk foreign key (x) references p(x);  

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA  

http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Fri Aug 28 1998 - 09:04:55 CDT

Original text of this message

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