ON DELETE CASCADE and CASCADE CONSTRAINTS ==================================================== CREATE TABLE DEPTX (DEPTNO NUMBER PRIMARY KEY, DNAME VARCHAR2(10)) ; CREATE TABLE EMPx (EMPNO NUMBER PRIMARY KEY, ENAME VARCHAR2(10), DEPTNO NUMBER CONSTRAINT EMP_DEPT_FK REFERENCES DEPTX (deptno) ON DELETE CASCADE ); INSERT INTO DEPTx (deptno,dname) VALUES (50,'CREDIT'); INSERT INTO EMPx (EMPNO,ENAME,DEPTNO) VALUES (9999,'JOEL',50); SQL> insert into EMPx values (999,'XXXXX',50); 1 row created. SQL> commit ; Commit complete. SQL> delete from deptx where DEPTNO=50; 1 row deleted. SQL> commit ; Commit complete. SQL> select * from EMPx ; no rows selected
Search This Blog
Total Pageviews
Tuesday, 18 November 2025
ON DELETE CASCADE | CASCADE CONSTRAINTS
Subscribe to:
Comments (Atom)
Oracle DBA
anuj blog Archive
- ► 2011 (362)
