Jump to content

Urgent SQL Oracle help

owencrispy
Go to solution Solved by programmer,
On 5/7/2018 at 8:56 PM, owencrispy said:

currently going out of my mind as I have an exam on SQL tomorrow and i can't for the life of me figure out this error:

 


INSERT INTO treatment VALUES ('1',DATE'2018-12-12','injection', REFERENCES animal(animalno)'001')
 


ORA-00917: missing comma

 

can someone please point out where i'm going wrong there and if that is right, where am i missing the comma? (trying to insert data into a table with a foreign key)

Probably too late - but I'm guessing the issue is that you don't have a column for REFERENCES animal(animalno) to apply to.

https://www.w3schools.com/sql/sql_foreignkey.asp

currently going out of my mind as I have an exam on SQL tomorrow and i can't for the life of me figure out this error:

 

INSERT INTO treatment VALUES ('1',DATE'2018-12-12','injection', REFERENCES animal(animalno)'001')
 


ORA-00917: missing comma

 

can someone please point out where i'm going wrong there and if that is right, where am i missing the comma? (trying to insert data into a table with a foreign key)

Link to comment
Share on other sites

Link to post
Share on other sites

That insert statement is quite weird. Could you paste the table structures of the "treatment" and "animal" tables?

 

Of course might be too late now, but worth a shot.

Link to comment
Share on other sites

Link to post
Share on other sites

On 5/7/2018 at 8:56 PM, owencrispy said:

currently going out of my mind as I have an exam on SQL tomorrow and i can't for the life of me figure out this error:

 


INSERT INTO treatment VALUES ('1',DATE'2018-12-12','injection', REFERENCES animal(animalno)'001')
 


ORA-00917: missing comma

 

can someone please point out where i'm going wrong there and if that is right, where am i missing the comma? (trying to insert data into a table with a foreign key)

Probably too late - but I'm guessing the issue is that you don't have a column for REFERENCES animal(animalno) to apply to.

https://www.w3schools.com/sql/sql_foreignkey.asp

Web Developer and Java contractor

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×