|
|
|
Re: Insert compound foreign key after table creation [message #347861 is a reply to message #347858] |
Sun, 14 September 2008 13:02   |
juanp.contreras
Messages: 8 Registered: September 2008
|
Junior Member |
|
|
Thanks for your interest...
Look:
CREATE TABLE CLIENTE(
"NOMBRE" VARCHAR2(30 BYTE) NOT NULL ENABLE,
"GENERO" VARCHAR2(4 BYTE),
"FECHANACIMIENTO" DATE NOT NULL ENABLE,
CONSTRAINT "CLIENTE_PK" PRIMARY KEY ("NOMBRE", "FECHANACIMIENTO"));
CREATE TABLE PLAN(
NUMCONTRATO NUMBER NOT NULL,
FECHAINICIO DATE,
FECHAFIN DATE,
PRECIO NUMBER,
CONENTRENADORPERSONAL CHAR(2 CHAR),
CONSTRAINT PLAN_PK PRIMARY KEY (NUMCONTRATO) ENABLE
)
The error:
ORA-02256: Number of referencing columns must mach the number of referenced columns
Yes... I know that Oracle is saying that the columns should be the same (and also the datatypes...). I now understand that it has to be like Oracle says because the joins and every else relational operator has to be able to work in the table....
I want to know where I have to put a new (common) attribute taking into account that I want a client from CLIENTE to has many (or at least one...) plans in Plan
thanks
|
|
|
|
Re: Insert compound foreign key after table creation [message #347866 is a reply to message #347863] |
Sun, 14 September 2008 13:28   |
juanp.contreras
Messages: 8 Registered: September 2008
|
Junior Member |
|
|
Excuse me... my sqlplus doesnt let me to cut and paste test so I had to write everything...
Ok... let then me ask only for the table design:
suppose that I have the following tables:
TableA(p,q,r) with (p,q) as the primary key
TableB(x,y) with x s the primary key
The semantic relationship that I want to stablish in the tables is:
"For every row of TableA, there is one or many rows of TableB related to it"
As I said in a post before, im thinking about adding some common attribute to one (or both) tables
thanks for your patience...
|
|
|
|
|
|