-1

我在这方面没有太多经验..当我尝试插入表格时出现此错误。

这是代码:

CREATE TABLE factory
(idfactory INT NOT NULL,
location_id INT NOT NULL,
owner INT NOT NULL,
CONSTRAINT factory_id_pk PRIMARY KEY(idfactory),
CONSTRAINT f_location_id_fk FOREIGN KEY(location_id) REFERENCES location(idLocation),
CONSTRAINT s_owner_id_fk FOREIGN KEY(owner) REFERENCES employees(idEmployee));


CREATE TABLE location
(idLocation INT NOT NULL,
Name VARCHAR(45),
region_id INT NOT NULL,
CONSTRAINT location_id_pk PRIMARY KEY(idLocation),
CONSTRAINT p_location_id_fk FOREIGN KEY(region_id) REFERENCES region(idRegion));


CREATE TABLE employees
(idEmployee INT NOT NULL,
Name VARCHAR(20) NOT NULL,
location_id INT NOT NULL,
email VARCHAR(45),
CONSTRAINT emp_id_pk PRIMARY KEY(idEmployee),
CONSTRAINT emp_loc_fk FOREIGN KEY(location_id) REFERENCES location(IdLocation);

插入:

INSERT INTO factory(factory_id_sequence.NEXTVAL,43,23); 

我得到了这个错误..我看不出有什么错误。

非常感谢!

4

1 回答 1

2

您需要VALUES在插入语句中有关键字:

INSERT INTO factory VALUES (factory_id_sequence.NEXTVAL,43,23); 
于 2016-01-14T10:57:53.410 回答