-
Examples of On Delete Cascade/Set Null .
-
-
I think that you need to do a set null with trigger based ri.
-
bensr Nice example
The following examples of CREATE TABLE statements show the definition of several integrity constraints:
CREATE TABLE Dept_tab (
Deptno NUMBER(3) CONSTRAINT Dept_pkey PRIMARY KEY,
Dname VARCHAR2(15),
Loc VARCHAR2(15),
CONSTRAINT Dname_ukey UNIQUE (Dname, Loc),
CONSTRAINT Loc_check1
CHECK (loc IN ('NEW YORK', 'BOSTON', 'CHICAGO')));
CREATE TABLE Emp_tab (
Empno NUMBER(5) CONSTRAINT Emp_pkey PRIMARY KEY,
Ename VARCHAR2(15) NOT NULL,
Job VARCHAR2(10),
Mgr NUMBER(5) CONSTRAINT Mgr_fkey
REFERENCES Emp_tab,
Hiredate DATE,
Sal NUMBER(7,2),
Comm NUMBER(5,2),
Deptno NUMBER(3) NOT NULL
CONSTRAINT dept_fkey REFERENCES Dept_tab ON DELETE CASCADE);
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
|
Click Here to Expand Forum to Full Width
|