Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.oracle.misc > #883

Foreign Keys

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!bloom-beacon.mit.edu!bloom-beacon.mit.edu!panix!not-for-mail
From ruben safir <dont@email.me>
Newsgroups comp.databases.oracle.misc
Subject Foreign Keys
Date Mon, 24 Nov 2014 16:25:54 +0000 (UTC)
Organization PANIX Public Access Internet and UNIX, NYC
Lines 44
Message-ID <m4vm6i$hja$2@reader1.panix.com> (permalink)
NNTP-Posting-Host 96.57.23.82
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
X-Trace reader1.panix.com 1416846354 18026 96.57.23.82 (24 Nov 2014 16:25:54 GMT)
X-Complaints-To abuse@panix.com
NNTP-Posting-Date Mon, 24 Nov 2014 16:25:54 +0000 (UTC)
User-Agent Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2)
Xref csiph.com comp.databases.oracle.misc:883

Show key headers only | View raw





I have this very simple practice database is 11g and I can't add a foreign
key to a table.  Maybe someone can tell me what I'm doing wrong.

I have table one

create table employee(
        fname varchar2(20) NOT NULL, minit char(1),
        lname varchar2(20) NOT NULL, ssn number(9) NOT NULL,
        bdate date NOT NULL,
        address varchar2(50) NOT NULL,
        sex char(1) NOT NULL,
        salary float(12) NOT NULL, superssn number(9),
        dno number(2)
        );

I set a primary key

alter table employee add constraint pk_employee primary key (ssn)
/

I create table two


create table works_on(
                essn number(9),
                pno number(2), hours float(5) );


ALTER TABLE WORKS_ON ADD CONSTRAINT workson_essn FOREIGN KEY (ESSN)
REFERENCES EMPLOYEE (SSN);

SQL> @fk_workson_essn.sql ADD CONSTRAINT workson_essn
               *
ERROR at line 2:
ORA-02298: cannot validate (RUBEN.WORKSON_ESSN) - parent keys not found

what is the error?

-- 
The Coin Hangout: http://www.coinhangout.com/home

Back to comp.databases.oracle.misc | Previous | NextNext in thread | Find similar


Thread

Foreign Keys ruben safir <dont@email.me> - 2014-11-24 16:25 +0000
  Re: Foreign Keys ddf <oratune@msn.com> - 2014-11-25 11:02 -0800
  Re: Foreign Keys ddf <oratune@msn.com> - 2014-12-01 05:46 -0800
    Re: Foreign Keys ruben safir <ruben@mrbrklyn.com> - 2014-12-12 02:23 -0500

csiph-web