0

Hi
Please why I got this error(SQL Error: ORA-00907: missing right parenthesis) whats wrong in my code?

CREATE TABLE artphoto(
        photonr NUMBER(10),
        artnr   NUMBER(10) NOT NULL,
        filtyp  VARCHAR2(5) NOT NULL,
        path    VARCHAR2(100) NOT NULL,

        CONSTRAINT artphoto_photonr_pk PRIMARY KEY(photonr),
        CONSTRAINT artphoto_artnr_fk FOREIGEN KEY(artnr),
            REFERENCES art(artnr),
        CONSTRAINT artphoto_filtyp_ck CHECK(filtyp in ('gif','jpg'))
);

Error starting at line 1 in command:

CREATE TABLE artphoto(
        photonr NUMBER(10),
        artnr   NUMBER(10) NOT NULL,
        filtyp  VARCHAR2(3) NOT NULL,
        path    VARCHAR2(200) NOT NULL,

        CONSTRAINT artphoto_photonr_pk PRIMARY KEY(photonr),
        CONSTRAINT artphoto_artnr_fk FOREIGEN KEY(artnr),
            REFERENCES art(artnr),
        CONSTRAINT artphoto_filtyp_ck CHECK(filtyp in ('gif','jpg'))

)
Error at Command Line:8 Column:44
Error report:
SQL Error: ORA-00907: missing right parenthesis
00907. 00000 - "missing right parenthesis"

Edited by tony75

5
Contributors
6
Replies
46
Views
4 Years
Discussion Span
Last Post by pallavi_4
0

try removing the comma after the last column and put your right paren there. you need to actually create the table before you can add any constraints.

Edited by bhartman21

0

Thanks Sir
You mean like this?

CONSTRAINT artphoto_artnr_fk FOREIGEN KEY(artnr),
REFERENCES art(artnr))

Edited by tony75

1

there are two erros in this:-

  • spelling of FOREIGEN KEY.Change it to "FOREIGN KEY"

  • remove comma before REFERENCES.

So the final query must be like this

CREATE TABLE artphoto(
        photonr NUMBER(10),
        artnr   NUMBER(10) NOT NULL,
        filtyp  VARCHAR2(3) NOT NULL,
        path    VARCHAR2(200) NOT NULL,

        CONSTRAINT artphoto_photonr_pk PRIMARY KEY(photonr),
        CONSTRAINT artphoto_artnr_fk FOREIGN KEY(artnr)  REFERENCES art(artnr),
        CONSTRAINT artphoto_filtyp_ck CHECK(filtyp in ('gif','jpg'))
        );

Hope it solves your problem.

Edited by IIM

0

SQL> CREATE TABLE client_master(client_name varchar(8) PRIMARY KEY,name VARCHAR(30) NOT NULL,address VARCHAR(25) NOT NULL,city VARCHAR(10) NOT NULL,pin_code NUMBER(08) NOT NULL,state VARCHAR(15) NOT NULL,Balance_Due VARCHAR(10,2) NOT NULL);

ERROR at line 1:
ORA-00907: missing right parenthesis

showing this.... what should i do????

Edited by Pranjal_1

0

CREATE TABLE client_master(client_name varchar(8) PRIMARY KEY,name VARCHAR(30) NOT NULL,address VARCHAR(25) NOT NULL,city VARCHAR(10) NOT NULL,pin_code NUMBER(08) NOT NULL,state VARCHAR(15) NOT NULL,Balance_Due VARCHAR(10) NOT NULL);

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.