Skip to main content
1 de 2

ORA-02253: constraint specification not allowed here

Hola buenas tengo esta tabla creada en oracle:

CREATE TABLE SUBCONTRACT(
CIF CHAR(9) NOT NULL CONSTRAINT PK_SUBCONTRACTS_CIF primary key,
NAME VARCHAR2(50) NOT NULL,
ADDRESSSTREET varchar2(50) not null,
ADDRESSNUM  number(7,0) not null,
ADDRESSFLOOR varchar2(4) null,
ACCOUNTNUMBER char(24) not null,
EMAIL varchar2(50) not null,
PRICES NUMBER(10,2),
SERVICE VARCHAR(40)
);

y al añadir otra para los numeros de telefono:

CREATE TABLE SUBCONTRACTSPHONENUMBER(
CIFSUBCONTRACT CHAR(9) not null CONSTRAINT FK_SUBCONTRACTS_CIF foreign key references SUBCONTRACTS(CIF),
PHONENUMBER NUMBER(11),
CONSTRAINT PK_SUBCONTRACTSPHONENUMBER_SUBCON_PHO PRIMARY KEY (CIFSUBCONTRACT,PHONENUMBER)
);

me da el error : ORA-02253: constraint specification not allowed here.

El numero de telefono y el cif tienen que ser claves primarias y el cif es foreign de subcontracts.

Un saludo.Muchas gracias.