Thanks a lot!
Assumed, there is a third table like this:
CREATE TABLE table3 (
Attr1 VARCHAR(2) NOT NULL WITH DEFAULT 'XY'.
Attr3 INTEGER NOT NULL,
Attr5 INTEGER NOT NULL,
Attr6 INTEGER NOT NULL,
);
CREATE UNIQUE INDEX table3_UI ON table3 ( Attr1, Attr3, Attr5 ) PCTFREE 0;
ALTER TABLE table3 ADD CONSTRAINT table3_PK PRIMARY KEY ( Attr1, Attr3, Attr5 );
ALTER TABLE table3 ADD FOREIGN KEY table3_FK (Attr1, Attr3) REFERENCES table2 (Attr1, Attr3) ON DELETE NO ACTION;
In this case table1 and table3 are not directy connected... Is this construction valid without any additional check constraints?
Quote:
Originally posted by Marcus_A
If you want the default of Attr1 on Table2 to be 'XY' then you will have to specify that default on the column definition of Attr1 for Table2. But a CHECK CONSTRAINT on table2 like the one on table1 would be redundant since that is handled by the RI.
Note that even if the default is assigned to Attr1 on table1 and table2, a parent row for 'XY� must exist on table1 for the RI constraint on table2 to be valid.
|