Niamh7689 Niamh7689 - 3 years ago 116
SQL Question

Apex 5 Error, ORA-00907: missing right parenthesis. Can't see missing parenthesis?

I am currently doing my coursework for university. I have this code, and cannot work out why I am getting issues. Can anyone help? It executes the generate sequence command, but not the create tables one, so I therefore cannot see it on the object browser.

If this helps:


  1. QuizID is to be generated by a sequence.

  2. QuizTitle, is at most 15 characters, and is not null.

  3. Category is to default to Music with Sports and Geography as the only other available options.



SQL code:

CREATE TABLE Quiz_NLB_2
(
QuizID NUMBER,
QuizTitle VARCHAR2(15) NOT NULL,
Category VARCHAR2(9) DEFAULT 'Music',

CONSTRAINT pk_QuizID PRIMARY KEY (QuizID),
CONSTRAINT chk_Category CHECK (Category='Music', 'Sports', 'Geography')

);

CREATE SEQUENCE QuizID_Sequence_Gen START WITH 100;

Answer Source

The check constraint should look like this:

CONSTRAINT chk_Category
    CHECK (Category IN ('Music', 'Sports', 'Geography'))
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download