
necesito ayuda con este error: ORA-02270: no matching unique or primary key for this column-list
Publicado por Francesco (2 intervenciones) el 12/02/2022 12:46:54
TENGO LAS SIGUIENTES TABLAS. LA PRIMERA Y LA SEGUNDA SE CREAN CORRECTAMENTE, PERO AL INTENTAR CREAR LA TERCERA ME SALTA EL SIGUIENTE MENSAJE:
ORA-02270: no matching unique or primary key for this column-list
¿ALGUIEN SABE QUÉ OCURRE? HE BUSCADO EN FOROS Y LAS RESPUESTAS QUE HE ENCONTRADO NO ME HAN SERVIDO
create table hospital (
hospital_cod number(2),
nombre varchar2(10),
direccion varchar2(20),
tfno varchar2(8),
num_cama number(3),
constraint pk_1 primary key (hospital_cod)
);
create table sala (
hospital_cod number(2),
sala_cod number(2),
nombre varchar2(20),
num_cama number(3),
constraint fk_2 foreign key (hospital_cod) references hospital(hospital_cod),
constraint pk_2 primary key (hospital_cod, sala_cod)
);
create table plantilla (
hospital_cod number(2),
sala_cod number(2),
empleado_no number(4),
apellido varchar2(15),
funcion varchar2(10),
turno varchar2(1),
salario number(10),
constraint fk_3a foreign key (hospital_cod) references hospital(hospital_cod),
constraint fk_3b foreign key (sala_cod) references sala(sala_cod),
constraint pk_3 primary key (hospital_cod, sala_cod, empleado_no)
);
ORA-02270: no matching unique or primary key for this column-list
¿ALGUIEN SABE QUÉ OCURRE? HE BUSCADO EN FOROS Y LAS RESPUESTAS QUE HE ENCONTRADO NO ME HAN SERVIDO
create table hospital (
hospital_cod number(2),
nombre varchar2(10),
direccion varchar2(20),
tfno varchar2(8),
num_cama number(3),
constraint pk_1 primary key (hospital_cod)
);
create table sala (
hospital_cod number(2),
sala_cod number(2),
nombre varchar2(20),
num_cama number(3),
constraint fk_2 foreign key (hospital_cod) references hospital(hospital_cod),
constraint pk_2 primary key (hospital_cod, sala_cod)
);
create table plantilla (
hospital_cod number(2),
sala_cod number(2),
empleado_no number(4),
apellido varchar2(15),
funcion varchar2(10),
turno varchar2(1),
salario number(10),
constraint fk_3a foreign key (hospital_cod) references hospital(hospital_cod),
constraint fk_3b foreign key (sala_cod) references sala(sala_cod),
constraint pk_3 primary key (hospital_cod, sala_cod, empleado_no)
);
Valora esta pregunta


0