DariPles DariPles - 1 month ago 9
SQL Question

ORA-00907: missing right parenthesis oracle sql

I am trying to create tables in oracle application express. All the tables created well except of Chessplayer and i really don't know what's the matter.
Can somebody please tell me what's wrong with the SQL below.

DROP TABLE –°hessplayer CASCADE CONSTRAINTS;

CREATE TABLE Chessplayer
(
Chessplayer_ID INTEGER NOT NULL ,
Surname CHAR (50) ,
Name CHAR (40) ,
Fathers_name CHAR (40) ,
Side CHAR (10) ,
Birth_date DATE ,
Date_of_entering DATE ,
Privelegies CLOB ,
Levels INTEGER Levels > 0 AND Levels < 6 ,
Part_ID INTEGER NOT NULL ,
Money_ID INTEGER NOT NULL
) ;

ALTER TABLE Chessplayer ADD CONSTRAINT Chessplayer_PK PRIMARY KEY ( Chessplayer_ID ) ;

INSERT INTO Chessplayer VALUES
(1,'Ivanov','Igor','Vladimirivich','WHITE', to_date('6-8-1993','dd-mm-yyyy'), to_date('17-1-2013','dd-mm-yyyy'), 'SUPER SMART',1,1,1);
INSERT INTO Chessplayer VALUES
(2,'Sokolov','Andrey','Semenovich','BLACK', to_date('20-8-1994','dd-mm-yyyy'), to_date('15-6-2014','dd-mm-yyyy'), 'SUPER SMART',1,1,1);
INSERT INTO Chessplayer VALUES
(3,'Smelev','Victor','Petrovich','WHITE', to_date('11-9-1992','dd-mm-yyyy'), to_date('21-12-2014','dd-mm-yyyy'), 'SUPER SMART',1,2,1);
INSERT INTO Chessplayer VALUES
(4,'Sidorov','Sergey','Igorevich','BLACK', to_date('6-8-1993','dd-mm-yyyy'), to_date('17-1-2013','dd-mm-yyyy'), 'SUPER SMART',1,2,1);
INSERT INTO Chessplayer VALUES
(5,'Sidorov','Sergey','Igorevich','BLACK', to_date('6-8-1993','dd-mm-yyyy'), to_date('17-1-2013','dd-mm-yyyy'), 'SUPER SMART',1,3,1);
INSERT INTO Chessplayer VALUES
(6,'Ivanov','Igor','Vladimirivich','WHITE', to_date('6-8-1993','dd-mm-yyyy'), to_date('17-1-2013','dd-mm-yyyy'), 'SUPER SMART',1,3,1);

INSERT INTO Chessplayer VALUES
(7,'Timurov','Aleksey','Geogrievich','WHITE', to_date('6-8-1993','dd-mm-yyyy'), to_date('17-1-2013','dd-mm-yyyy'), 'SUPER SMART',1,1,2);
INSERT INTO Chessplayer VALUES
(8,'Antonevich','Egor','Vasilievich','BLACK', to_date('6-8-1993','dd-mm-yyyy'), to_date('17-1-2013','dd-mm-yyyy'), 'SUPER SMART',1,1,2);
INSERT INTO Chessplayer VALUES
(9,'Stepanov','Aleksandr','Vladimirivich','WHITE', to_date('6-8-1993','dd-mm-yyyy'), to_date('17-1-2013','dd-mm-yyyy'), 'SUPER SMART',1,2,2);
INSERT INTO Chessplayer VALUES
(10,'Kireev','Vadim','Sergeevich','BLACK', to_date('6-8-1993','dd-mm-yyyy'), to_date('17-1-2013','dd-mm-yyyy'), 'SUPER SMART',1,2,2);
INSERT INTO Chessplayer VALUES
(11,'Timurov','Aleksey','Geogrievich','BLACK', to_date('6-8-1993','dd-mm-yyyy'), to_date('17-1-2013','dd-mm-yyyy'), 'SUPER SMART',1,3,2);
INSERT INTO Chessplayer VALUES
(12,'Stepanov','Aleksandr','Vladimirivich','WHITE', to_date('6-8-1993','dd-mm-yyyy'), to_date('17-1-2013','dd-mm-yyyy'), 'SUPER SMART',1,3,2);


ALTER TABLE Chessplayer ADD CONSTRAINT Chesspl_Reg_contr_FK FOREIGN KEY ( Money_ID ) REFERENCES Reg_contribution ( Reg_contr_ID ) ;

ALTER TABLE Chessplayer ADD CONSTRAINT Chessplayer_Party_FK FOREIGN KEY ( Part_ID ) REFERENCES Party ( Party_ID ) ;


And here's the errors in oracle application express:
CREATE TABLE Chessplayer ( Chessplayer_ID ORA-00907: missing right parenthesis

ALTER TABLE Chessplayer ADD CONSTRAINT Chessplayer_PK PRIMAR ORA-02260: table can have only one primary key

and for all inserts:
ORA-01722: invalid number

Gar Gar
Answer

I would have written the table creation this way

-- Create table
create table CHESSPLAYER
(
  CHESSPLAYER_ID   INTEGER not null,
  SURNAME          CHAR(50),
  NAME             CHAR(40),
  FATHERS_NAME     CHAR(40),
  SIDE             CHAR(10),
  BIRTH_DATE       DATE,
  DATE_OF_ENTERING DATE,
  PRIVELEGIES      CLOB,
  LEVELS           INTEGER,
  PART_ID          INTEGER not null,
  MONEY_ID         INTEGER not null
);

-- Create/Recreate check constraints 
alter table CHESSPLAYER
  add constraint CHKLEV
  check (Levels > 0 AND Levels < 6);

That should solve all of your problems

Comments