ORA-00904 :: Oracle Life数据库中的无效标识符

即使我将其作为脚本运行,我也遇到了错误。首先,我没有使用“ wrent_id”,仍然出现错误。

CREATE TABLE want_renting ( 
    'wrent_id' int NOT NULL PRIMARY KEY, 
    'property_id' int, 
    'client_id' int, 
    'agent_id' int, 
    'wrent_date' date, 
    'expired_date' date, 
    CONSTRAINT 'fk_property'  FOREIGN KEY ('property_id') REFERENCES 'property'('property_id'), 
    CONSTRAINT 'fk_client'  FOREIGN KEY ('client_id')  REFERENCES 'clients'('client_id'), 
    CONSTRAINT 'fk_agent'  FOREIGN KEY ('agent_id')  REFERENCES 'agents'('agent_id'),  
);
ORA-00904: : invalid identifier
评论
m,嗨起
m,嗨起

嗨约瑟夫,

从查询中删除引号。引号用于删除字符串,而不用于创建表。

CREATE TABLE want_renting ( 
wrent_id int NOT NULL PRIMARY KEY, 
property_id int, 
client_id int, 
agent_id int, 
wrent_date date, 
expired_date date, 
CONSTRAINT fk_property  FOREIGN KEY (property_id) REFERENCES 
property(property_id), 
CONSTRAINT fk_client  FOREIGN KEY (client_id)  REFERENCES clients(client_id), 
CONSTRAINT fk_agent  FOREIGN KEY (agent_id)  REFERENCES agents(agent_id)  
);

并确保所有其他表都引用外键

点赞
评论