【问题标题】:ORA-00904: "CUSTID": invalid identifierORA-00904: "CUSTID": 无效标识符
【发布时间】:2021-08-08 11:35:41
【问题描述】:
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,
    Amount number(10),
    foreign key(Custid) references Customer(Custid)
    );
    

执行上述创建表查询时,我收到一个错误

ORA-00904:“CUSTID”:标识符无效

【问题讨论】:

  • 您忘记了最后 2 个表格中的 custid 列。

标签: oracle ora-00904


【解决方案1】:

您忘记在 HomeLoanVehicleLoan 表中创建列 Custid

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,
    Amount number(10),
    Custid number(20),
    CONSTRAINT fk_customer FOREIGN KEY (Custid) REFERENCES Customer(Custid)
    );

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-01-22
    • 2011-08-27
    • 2011-04-21
    • 2019-06-29
    • 2013-10-20
    • 2017-12-29
    • 2015-07-25
    相关资源
    最近更新 更多