Dana
Dana

Reputation: 107

ORA-01747_invalid user.table.column, table.column, or column specification

I don't have so many experience in this..I've got this error when I tried to insert into table.

Here's code:

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:

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

And i got this error..I can't see what's mistake.

Thanks a lot!

Upvotes: -1

Views: 184

Answers (1)

jera
jera

Reputation: 322

You need to have the VALUES keyword in the insert statement:

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

Upvotes: 2

Related Questions