It is not possible to have one foreign key referring to fields in different tables, and this makes no sense. A foreign key of two or more fields implies that the combination of field values must correspond to one record of the table referenced, and this is not possible if the specified fields are in different tables.
What you can do is create two different keys for both tables:
CREATE TABLE table3(
iid NUMBER,
Tid NUMBER,
Sid NUMBER,
CONSTRAINT pk PRIMARY KEY (iid) USING INDEX TABLESPACE idx,
CONSTRAINT fk001 FOREIGN KEY (tid) REFERENCES table1(tid),
CONSTRAINT fk002 FOREIGN KEY (sid) REFERENCES table2(sid)
);
Carlo source
share