我正在创建一个试图从外键访问值的数据库。我创建了两个下表
CREATE TABLE Component(
ComponentID varchar2(9) PRIMARY KEY
, TypeID varchar2(9) REFERENCES TypeComponent(TypeComponentID)
)
INSERT INTO Component VALUES(192359823,785404309)
INSERT INTO Component VALUES(192359347,785404574)
INSERT INTO Component VALUES(192359467,785404769)
INSERT INTO Component VALUES(192359845,785404867)
INSERT INTO Component VALUES(192359303,785404201)
INSERT INTO Component VALUES(192359942,785404675)
CREATE TABLE TypeComponent (
TypeComponentID varchar2(9) PRIMARY KEY
, Type_Description varchar2(30) CONSTRAINT Type_Description
CHECK(Type_Description IN('Strap', 'Buckle', 'Stud')) NOT NULL
)
INSERT INTO TypeComponent VALUES(785404309, 'Strap')
INSERT INTO TypeComponent VALUES(785404574, 'Stud')
INSERT INTO TypeComponent VALUES(785404769, 'Buckle')
INSERT INTO TypeComponent VALUES(785404867, 'Strap')
INSERT INTO TypeComponent VALUES(785404201, 'Buckle')
INSERT INTO TypeComponent VALUES(785404675, 'Stud')
这是两张表。Component
和TypeComponent
。Component
是 的父实体TypeComponent
,我正在尝试运行以下 INSERT 语句:
INSERT INTO Component VALUES(192359823,785404309)
但它给了我错误
这是我迄今为止在 Oracle SQL 开发中的会话