Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> FOREIGN KEY
I am setting a database under Oracle 8.
I need to link two tables (father and child) with a FOREIGN KEY
So far I have done:
child table
CREATE TABLE PROG
(ID_PROG VARCHAR2(5),
.ID_BEN VARCHAR2(50));
father table
CREATE TABLE BEN(ID_B VARCHAR2(5), ...);
foreign key
ALTER TABLE PROG ADD CONSTRAINT FK_IDBEN_PROG FOREIGN KEY (ID_BEN)
REFERENCES BEN (ID_B) ON DELETE CASCADE;
The question is: is it available the SQL keyword ON UPDATE CASCATE
(instead of ON DELETE CADSCADE) in the CONSTRAINT statement? Standard
SQL books say its a possible option, but I have found nothing in Oracle
documentation and SQL*Plus does not accept it.
If it is not possible, which is the best way to change ID_B in BEN table and consequently ID_BEN in PROG table? Just by code, inserting new record in father table (the same field values except ID_B), change related records in child table, delete old record in father table? PS: I use Delphi 3 as client application environment.
Thanks in advance Received on Wed Aug 25 1999 - 05:08:23 CDT