954,561 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

command line SQL in SQL*Plus

This is probably obvious to someone who is familiar with Oracle, however, I'm writing a script file for a class, and it throws an error on the line

ALTER TABLE FACULTY
ADD CONSTRAINT FACULTY_Locid_fk REFERENCES LOCATION;


where the table is FACULTY, the column is Locid, and I'm trying to create a foreign key that references the LOCATION table.
It gives me an Invalid Datatype.

In the same token the line

ALTER TABLE STUDENT
ADD CONSTRAINT STUDENT_Sstate DEFAULT 'WI';


gives me an invalid identifier error.

Any input on proper syntax would be helpful, and yes, I did Google it. :)

revjim44
Light Poster
28 posts since Jan 2011
Reputation Points: 10
Solved Threads: 0
 

1. referring and referenced table columns should be matching.

2. DEFAULT is not a constraint.

debasisdas
Posting Genius
6,872 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: