1

I'm new to SQL and Im trying to create a simple database, but I'm having problems with second one, I'm using Oracle Database express 11 and when I try to run this code I get error: Missing right parenthesis

CREATE table "CURSOS" (
    "Nombre_curso" VARCHAR2(20) UNIQUE,
    "Cod_curso"  VARCHAR2(10),
    "Apellido2"  VARCHAR2(15),
    "NIF_Prof"   VARCHAR2(9),
    "Max_al"     INT (2),
    "Fecha_ini"  DATE,
    "Fecha_fin"  DATE,
    "Horas"      INt(6) NOT NULL,
    constraint  "CURSOS_PK" primary key ("Cod_curso"),
    constraint  "CURSOS_CK" CHECK (Fecha_ini<Fecha_fin),
    constraint  "CURSOS_FK" FOREIGN KEY (Nif_Prof) REFERENCES PROFESORES,
)
2
  • You should really stay away from quoted identifiers. In the long run they are much more trouble than they are worth it.
    – user1822
    Jan 2, 2015 at 21:11
  • Unless your column names must match case wise to an external to Oracle system, it's highly advised to not use lower or mixed case names for columns, constraints, tables, anything in fact. Your developers will thank you ! Oracle databases by default do not use case sensitivity. The case sensitivity is a complex advanced system, to be compatible with external systems that support this unnecessary feature. Your code will be 25% shorter, just removing all quotes.
    – tvCa
    Jan 3, 2015 at 17:29

1 Answer 1

2

I'll hazard the guess of the extra comma at the end of PROFESORES may be causing the error to be thrown. It's the only thing that looks out of place.

3
  • I agree with SQLHound the the comma after PROFESORES should not be there, also INT can't have a number after it. If you want the (2) or (6), then use the NUMBER datatype, not INT or INTEGER. They are just sub-types of number anyway.
    – Gandolf989
    Jan 2, 2015 at 15:40
  • 3
    And i would say: remove those bloody quotes! Unless ypu really want case sensitive column names...
    – ETL
    Jan 2, 2015 at 16:11
  • Agree with that, although I have put it differently ;)
    – tvCa
    Jan 3, 2015 at 17:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.