I am currently trying to build a database but have become stuck after creating the tables. I have tried inserting values into a table but it gives me the following error:
Error starting at line : 73 in command –
INSERT INTO Project(ProjID, ProjName, ProjStartDate) VALUES (00, Project1, DATE '1900-02-14')
Error at Command Line : 73 Column : 66
Error report –
SQL Error: ORA-00984: column not allowed here
00984. 00000 – “column not allowed here”
*Cause:
*Action:
I am really struggling to find what is wrong with this but i am new to oracle so am not sure, any help would be greatly appreciated.
My code can be seen below:
--CREATE SCRIPTS /*put your create scripts here – your script should not commented out*/ -- this is creating a table called Project that contains 3 variables, the primary key being ProjectID CREATE TABLE Project ( ProjID integer, ProjName varchar(10), ProjStartDate date, primary key (ProjID) ) -- this is creating a table called Bug that has 4 variables, BugID being the primary key CREATE TABLE Bug ( BugID integer, BugType varchar(10), BugDesc varchar(10), BugTime timestamp(3), primary key(BugID) ) -- this is creating a table called Bug_Project with 2 variables; BugID and ProjectID which combine and make a composite key CREATE TABLE Bug_Project ( BugID integer, ProjID integer, primary key(BugID, ProjID), foreign key(BugID) references Bug (BugID), foreign key(ProjID) references Project (ProjID) ) CREATE TABLE Engineer ( EngineerID integer, EngineerName varchar(10), EngineerType varchar(20), primary key (EngineerID) ) CREATE TABLE Fix_Allocation ( EngineerID integer, BugID integer, primary key(EngineerID, BugID), foreign key(EngineerID) references Engineer (EngineerID), foreign key(BugID) references Bug (BugID) ) CREATE TABLE Test_Allocation ( EngineerID integer, BugID integer, primary key(EngineerID, BugID), foreign key(EngineerID) references Engineer (EngineerID), foreign key(BugID) references Bug (BugID) ) CREATE TABLE Note ( EngineerID integer, BugID integer, Note_author varchar(5), Note_contents varchar(20), primary key(EngineerID, BugID), foreign key(EngineerID) references Engineer (EngineerID), foreign key(BugID) references Bug (BugID) ) COMMIT; --INSERT SCRIPTS /*put your insert scripts here – your script should not commented out */ INSERT INTO Project(ProjID, ProjName, ProjStartDate) VALUES (00, Project1, DATE '1900-02-14');
Advertisement
Answer
for string value use single quote otherwise that value is as column name
INSERT INTO Project(ProjID, ProjName, ProjStartDate) VALUES ( 0, 'Project1', DATE '1900-02-14')