If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Oracle > A newbie question.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-25-12, 22:42
Jsin Jsin is offline
Registered User
 
Join Date: Jan 2012
Posts: 16
A newbie question.

Hello everyone,

I just started learning SQL and I was doing great so far and then I ran into a little problem. I am sure it's something small that I'm overlooking, but I am getting this message SP2-0734: unknown command beginning "CONSTRAINT..." - rest of line ignored., and I am not sure why, I have tried several different things and still get the same message. My other tables that are similar work just fine, so I have no clue. Here is the whole CREATE statement:

SQL> CREATE TABLE Course_Offering
2 (
3 CourseNo Varchar(10) NOT NULL,
4 Year Number(2) NOT NULL,
5 Semester Char(2) NOT NULL,
6 ProfNo Number(2) NOT NULL,
7 Room Varchar(5) NOT NULL,
8 Time Date NOT NULL,
9 Day Varchar(5) NOT NULL,
10
SQL> CONSTRAINT PKCourse_Offering PRIMARY KEY (CourseNo, Year, Semester, ProfNo),
SP2-0734: unknown command beginning "CONSTRAINT..." - rest of line ignored.
SQL> CONSTRAINT FKCOSemester FOREIGN KEY (Semester) References Semester_Master,
SP2-0734: unknown command beginning "CONSTRAINT..." - rest of line ignored.
SQL> CONSTRAINT FKCOCourseNo FOREIGN KEY (CourseNo) References Course_Mast,
SP2-0734: unknown command beginning "CONSTRAINT..." - rest of line ignored.
SQL> CONSTRAINT FKCOProfNo FOREIGN KEY (ProfNo) References Professor_Master);
SP2-0734: unknown command beginning "CONSTRAINT..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP

Thank you for any advice you have.
Reply With Quote
  #2 (permalink)  
Old 01-25-12, 23:14
anacedent anacedent is offline
Registered User
 
Join Date: Aug 2003
Location: Where the Surf Meets the Turf @Del Mar, CA
Posts: 6,416
try like below
Code:
CREATE TABLE course_offering
  (
     courseno VARCHAR(10) NOT NULL,
     YEAR     NUMBER(2) NOT NULL,
     semester CHAR(2) NOT NULL,
     profno   NUMBER(2) NOT NULL,
     room     VARCHAR(5) NOT NULL,
     TIME     DATE NOT NULL,
     DAY      VARCHAR(5) NOT NULL,
     CONSTRAINT pkcourse_offering PRIMARY KEY (courseno, YEAR, semester, profno)
     ,
     CONSTRAINT fkcosemester FOREIGN KEY (semester) REFERENCES semester_master,
     CONSTRAINT fkcocourseno FOREIGN KEY (courseno) REFERENCES course_mast,
     CONSTRAINT fkcoprofno FOREIGN KEY (profno) REFERENCES professor_master
  );
__________________
You can lead some folks to knowledge, but you can not make them think.
The average person thinks he's above average!
For most folks, they don't know, what they don't know.
Reply With Quote
  #3 (permalink)  
Old 01-25-12, 23:47
Jsin Jsin is offline
Registered User
 
Join Date: Jan 2012
Posts: 16
Thank you!

Thank you I knew it was going to be something simple like taking out a line space. Once again thank you!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On