问题描述
create table Customer(
Custid number (20) primary key,Custname char(20),phno number(10),pan varchar2(20),dob date
);
create table HomeLoan(
HLoanid number (20) primary key,Amount number(10),foreign key(Custid) references Customer(Custid)
);
create table VehicleLoan(
VLoanid number (20) primary key,foreign key(Custid) references Customer(Custid)
);
ORA-00904:“CUSTID”:无效标识符
解决方法
您忘记在 Custid
和 HomeLoan
表中创建列 VehicleLoan
:
CREATE TABLE Customer (
Custid number(20) PRIMARY KEY,Custname CHAR(20),phno number(10),pan varchar2(20),DOB DATE
);
CREATE TABLE HomeLoan (
HLoanid number(20) PRIMARY KEY,Amount number(10),Custid number(20),CONSTRAINT fk_customer FOREIGN KEY (Custid) REFERENCES Customer(Custid)
);
CREATE TABLE VehicleLoan (
VLoanid number(20) PRIMARY KEY,CONSTRAINT fk_customer FOREIGN KEY (Custid) REFERENCES Customer(Custid)
);