是SQLSERVER吧,ORACLE里没有关联删除的语法
解决方案 »
- 怎么查看数据文件的具体内容
- oracle建立定时计划报错:ORA-06550第 7 行, 第 88 列: PLS-00103: 出现符号 "FMWW"在需要下列之一时:
- alter database rename file出错
- 存储过程_错误
- 使用dblink远程读取blob或者clob字段的数据
- oracle通过透明网关连接SqlServer问题
- .bak文件无法执行?
- 一个技术群:14857829
- java.io.filenotfoundexception: /etc/oratab错误!!!!
- ORA-01733 错误,求高手指点
- 请教如何删除表中完全相同两条记录中的其中一条?
- Oracle连接
by search for "cascade".
This statement creates the emp table, defines and enables two referential integrity constraints, and uses the ON DELETE clause: CREATE TABLE emp
(empno NUMBER(4) PRIMARY KEY,
ename VARCHAR2(10),
job VARCHAR2(9),
mgr NUMBER(4) CONSTRAINT fk_mgr
REFERENCES emp ON DELETE SET NULL,
hiredate DATE,
sal NUMBER(7,2),
comm NUMBER(7,2),
deptno NUMBER(2) CONSTRAINT fk_deptno
REFERENCES dept(deptno)
ON DELETE CASCADE );
Because of the first ON DELETE clause, if manager number 2332 is deleted from the emp table, Oracle sets to null the value of mgr for all employees in the emp table who previously had manager 2332. Because of the second ON DELETE clause, Oracle cascades any deletion of a deptno value in the dept table to the deptno values of its dependent rows of the emp table. For example, if Department 20 is deleted from the dept table, Oracle deletes the department's employees from the emp table.
I think the easiest way to set cascade delete is using Erwin to create your tables,in which you can set the relation between two tables.