Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2005
    Posts
    1

    Unanswered: foregin key error

    HTML Code:
    create table Coustomer(Cnum number(5) not null,
                           Cfirstname char(15) not null,
    		       Clastname char(15) not null,
    		       Cstate varchar2(4) not null,
    		       CZipcode varchar2(5) not null,
    		       Ccity varchar2(15) not null,
    		       CAppt_details varchar2(15) not null,
                           Kindofvisa varchar2(8) not null,
    		       CAmount_spent real not null,
                           primary key(Cnum));
    
    
    
    create table Creditcard(Cardnum number(20) not null,
    			 Creditlimit number(10) not null,
                             Apr real not null,
                             Expdate date not null,
                             primary key(Cardnum) ,
    			FOREIGN KEY(Cnum) REFERENCES Coustomer(Cnum));
    
    
    
    this is the error i am getting
    
     CONSTRAINT coustomer_to_cnum_fk FOREIGN KEY(Cnum) REFERENCES Coustomer(Cnum))
                                                                         *
    ERROR at line 6:
    ORA-00904: invalid column name
    table or view does not exist
    [PHP]foregin[/PHP]

    Can any body help mme waht the problem isplz.....

  2. #2
    Join Date
    Nov 2005
    Posts
    2

    Wink

    Hello mazes,

    Try this one !


    create table Coustomer(
    Cnum number(5) not null,
    Cfirstname char(15) not null,
    Clastname char(15) not null,
    Cstate varchar2(4) not null,
    CZipcode varchar2(5) not null,
    Ccity varchar2(15) not null,
    CAppt_details varchar2(15) not null,
    Kindofvisa varchar2(8) not null,
    CAmount_spent real not null,
    CONSTRAINT PK_customer PRIMARY KEY(Cnum));


    create table Creditcard(
    Cnum number(5) not null,
    Cardnum number(20) not null,
    Creditlimit number(10) not null,
    Apr real not null,
    Expdate date not null,
    CONSTRAINT PK_Cardnum PRIMARY KEY(Cardnum),
    CONSTRAINT FK_Cnum FOREIGN KEY(Cnum) REFERENCES Coustomer);
    Last edited by jbo011; 11-20-05 at 16:40.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •