Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2012
    Posts
    16

    Unanswered: 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.

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    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.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    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!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •