-
on update restrict
hi i am in need of some assistance for my project ASAP . I am using SQL*Plus in Oracle 8.1.7 and am trying to restrict the deletion of rows from the parent relation "players" if the playerno is in the teams table. I have tried using the "ON DELETE CASCADE " and that works fine. How come the ON DELETE RESTRICT does not work??? I have also tried to use ON DELETE NO ACTION with no luck. PLEASE HELP !!
I have attached my code below for your refrernce:
CREATE TABLE teams
(teamno INT NOT NULL,
playerno INT NOT NULL,
division VARCHAR2(10) NOT NULL,
PRIMARY KEY(teamno),
FOREIGN KEY(playerno) REFERENCES players(playerno) ON DELETE RESTRICT);
-
solved my own problem
by DEFAULT the "on delete restrict" option is used in Oracle. In other words if you try to delete a parent record, and the primary key of that record is accessed by the foreign key(s) of any children, the application will not allow you to delete that parent record if you do not have any constraints explicitly written . You must write something like ON DELETE CASCADE (or other referential integity constraints) if you wish to delete a parent record refernced by children records.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|