Link to home
Start Free TrialLog in
Avatar of yongsing
yongsing

asked on

Foreign Key (ON DELETE CASCADE)

Look at this:

create TABLE BGW.YYY (
    ID number not null,
    PARENT_ID number not null references XXX(ID),
    PASSWORD varchar2(254) null
) TABLESPACE SSS;

Is it the same as the following two DDL?

create TABLE BGW.YYY (
    ID number not null,
    PARENT_ID number not null,
    PASSWORD varchar2(254) null
) TABLESPACE SSS;

ALTER TABLE BGW.YYY ADD (
    CONSTRAINT FK_YYY FOREIGN KEY (PARENT_ID)
    REFERENCES BGW.XXX (ID)
);

Do I need to add ON DELETE CASCADE to the ALTER TABLE statement to make it equivalent to the first CREATE TABLE statement?
ASKER CERTIFIED SOLUTION
Avatar of plamen73
plamen73

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial