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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Syntax for foreign key

RE: Syntax for foreign key

From: Robson, Peter <pgro_at_bgs.ac.uk>
Date: Thu, 27 Mar 2003 01:18:35 -0800
Message-ID: <F001.00574071.20030327011835@fatcity.com>


This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible.

------_=_NextPart_001_01C2F442.264E9BE0
Content-Type: text/plain; charset="iso-8859-1"  

-----Original Message-----
Sent: 26 March 2003 20:39
To: Multiple recipients of list ORACLE-L

Indexes are only automatically created to enforce primary key and unique constraints.
If you want an index to match the columns of a foreign key constraint, you will have to do it separately.
P.S. If you already have a non-unique index on the PK [Peter Robson]

Not possible - PK indexes are unique by definition.

peter    

 or unique constraint column(s), then Oracle will use that one to enforce the PK or unique constraint.

> -----Original Message-----
> From: DENNIS WILLIAMS [ mailto:DWILLIAMS_at_LIFETOUCH.COM
<mailto:DWILLIAMS_at_LIFETOUCH.COM> ]
>
> I'm trying to add a foreign key constraint to a table, and specify the
> tablespace and pctfree. Here is the syntax I'm using:
>
> alter table jobproductoutrigger add (
> constraint fk_jobprodu_currjobfa_currjobf foreign key (
> jobnbr, sourcefiscalyear )
> references currjobfact (jobnbr, sourcefiscalyear)
> using index tablespace index73
> pctfree 5)
> /
>
> This produced the error:
>
> ERROR at line 5:
> ORA-00907: missing right parenthesis
>
> Can someone spot what I'm missing? This is Oracle 8.1.6.



This e-mail message, and any files transmitted with it, are confidential and intended solely for the use of the addressee. If this message was not addressed to you, you have received it in error and any copying, distribution or other use of any part of it is strictly prohibited. Any views or opinions presented are solely those of the sender and do not necessarily represent those of the British Geological Survey. The security of e-mail communication cannot be guaranteed and the BGS accepts no liability for claims arising as a result of the use of this medium to transmit messages from or to the BGS. The BGS cannot accept any responsibility for viruses, so please
scan all attachments.                            http://www.bgs.ac.uk
*********************************************************************


------_=_NextPart_001_01C2F442.264E9BE0
Content-Type: text/html; charset="iso-8859-1"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>RE: Syntax for foreign key</TITLE>

<META content="MSHTML 5.50.4807.2300" name=GENERATOR></HEAD>
<BODY>

<DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV> <BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">   <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma   size=2>-----Original Message-----<BR><B>From:</B> Jacques Kilchoer   [mailto:Jacques.Kilchoer_at_quest.com]<BR><B>Sent:</B> 26 March 2003   20:39<BR><B>To:</B> Multiple recipients of list ORACLE-L<BR><B>Subject:</B>   RE: Syntax for foreign key<BR><BR></FONT></DIV>   <P><FONT size=2>Indexes are only automatically created to enforce primary key   and unique constraints.</FONT> <BR><FONT size=2>If you want an index to match   the columns of a foreign key constraint, you will have to do it   separately.</FONT> <BR><FONT size=2>P.S. If you already have a non-unique   index on the PK <BR><SPAN class=175092009-27032003><FONT face=Arial   color=#0000ff>[Peter Robson]&nbsp;</FONT></SPAN></FONT></P>   <P><FONT size=2><SPAN class=175092009-27032003>Not possible - PK indexes are   unique by definition.</SPAN></FONT></P>
  <P><FONT size=2><SPAN class=175092009-27032003>peter</SPAN></FONT></P>
  <P><FONT size=2><SPAN class=175092009-27032003></SPAN></FONT>&nbsp;</P>
  <P><FONT size=2><SPAN class=175092009-27032003></SPAN></FONT>&nbsp;</P>
  <P><FONT size=2><SPAN class=175092009-27032003>&nbsp;</SPAN>or unique 
  constraint column(s), then Oracle will use that one to enforce the PK or   unique constraint.</FONT></P>
  <P><FONT size=2>&gt; -----Original Message-----</FONT> <BR><FONT size=2>&gt;   From: DENNIS WILLIAMS [<A
  href="mailto:DWILLIAMS_at_LIFETOUCH.COM">mailto:DWILLIAMS_at_LIFETOUCH.COM</A>]</FONT>   <BR><FONT size=2>&gt; </FONT><BR><FONT size=2>&gt; I'm trying to add a foreign   key constraint to a table, and specify the</FONT> <BR><FONT size=2>&gt;   tablespace and pctfree. Here is the syntax I'm using:</FONT> <BR><FONT   size=2>&gt; </FONT><BR><FONT size=2>&gt; alter table jobproductoutrigger add   (</FONT> <BR><FONT size=2>&gt;&nbsp;&nbsp;&nbsp; constraint   fk_jobprodu_currjobfa_currjobf foreign key (</FONT> <BR><FONT   size=2>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; jobnbr, sourcefiscalyear )</FONT>   <BR><FONT size=2>&gt;&nbsp;&nbsp;&nbsp; references currjobfact (jobnbr,   sourcefiscalyear)</FONT> <BR><FONT size=2>&gt;&nbsp;&nbsp;&nbsp; using index   tablespace index73</FONT> <BR><FONT size=2>&gt;&nbsp;&nbsp;&nbsp; pctfree   5)</FONT> <BR><FONT size=2>&gt; /&nbsp;&nbsp;&nbsp;&nbsp; </FONT><BR><FONT   size=2>&gt; </FONT><BR><FONT size=2>&gt; This produced the error:</FONT>   <BR><FONT size=2>&gt; </FONT><BR><FONT size=2>&gt; ERROR at line 5:</FONT>   <BR><FONT size=2>&gt; ORA-00907: missing right parenthesis </FONT><BR><FONT   size=2>&gt; </FONT><BR><FONT size=2>&gt; Can someone spot what I'm missing?   This is Oracle 8.1.6.</FONT> </P></BLOCKQUOTE><FONT SIZE=3><BR> <BR>
*********************************************************************<BR>
This  e-mail   message,  and  any  files  transmitted   with  it, are<BR>
confidential  and intended  solely for the  use of the  addressee. If<BR>
this message was not addressed to  you, you have received it in error<BR>
and any  copying,  distribution  or  other use  of any part  of it is<BR>
strictly prohibited. Any views or opinions presented are solely those<BR>
of the sender and do not  necessarily represent  those of the British<BR>
Geological  Survey. The  security of e-mail  communication  cannot be<BR>
guaranteed and the BGS  accepts no liability  for claims arising as a<BR>
result of the use of this medium to  transmit messages from or to the<BR>
BGS. The BGS cannot accept any responsibility  for viruses, so please<BR>
scan all attachments.                            http://www.bgs.ac.uk<BR>
*********************************************************************<BR>
</FONT>
</BODY></HTML>

------_=_NextPart_001_01C2F442.264E9BE0--

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Robson, Peter
  INET: pgro_at_bgs.ac.uk

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Thu Mar 27 2003 - 03:18:35 CST

Original text of this message

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