Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: FOREIGN KEY

Re: FOREIGN KEY

From: Karen Abgarian <karen.abgarian_at_fmr.com>
Date: Thu, 26 Aug 1999 15:01:40 -0400
Message-ID: <37C58F13.F70D4F46@fmr.com>


Hi Francesco

On update cascade is not supported as a column/table constraint. You can implement
it by using triggers. It is very popular and there are plenty of "how to do" notes around.
I recall Thomas Kyte has something about it on his site. See T.K's messages.

Karen Abgarian.

francesco wrote:

> 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 it’s 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 Thu Aug 26 1999 - 14:01:40 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US