是SQLSERVER吧,ORACLE里没有关联删除的语法

解决方案 »

  1.   

    You can learn about cascade dropping in <oracle sql reference>
    by search for "cascade".
      

  2.   

    ON DELETE Example
    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. 
      

  3.   

    jiezhi(西域浪子) :你举的例子我看不明白,能明确点吗?
      

  4.   

    just read sql reference.
    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.