沒有加任何條件?
delete from table
where f='條件'
就這樣呀,另一表的也跟著也被刪了,另一表是它的從表。

解决方案 »

  1.   

    ON DELETE Clause
    The ON DELETE clause lets you determine how Oracle automatically maintains referential integrity if you remove a referenced primary or unique key value. If you omit this clause, then Oracle does not allow you to delete referenced key values in the parent table that have dependent rows in the child table.Specify CASCADE if you want Oracle to remove dependent foreign key values. 
    Specify SET NULL if you want Oracle to convert dependent foreign key values to NULL. 
    Restriction on ON DELETE
    You cannot specify this clause for a view constraint.ON DELETE Example
    This statement creates the dept_20 table, defines and enables two referential integrity constraints, and uses the ON DELETE clause:CREATE TABLE dept_20 
       (employee_id     NUMBER(4) PRIMARY KEY, 
        last_name       VARCHAR2(10), 
        job_id          VARCHAR2(9), 
        manager_id      NUMBER(4) CONSTRAINT fk_mgr
                        REFERENCES employees ON DELETE SET NULL, 
        hire_date       DATE, 
        salary          NUMBER(7,2), 
        commission_pct  NUMBER(7,2), 
        department_id   NUMBER(2)   CONSTRAINT fk_deptno 
                        REFERENCES departments(department_id) 
                        ON DELETE CASCADE ); 
    Because of the first ON DELETE clause, if manager number 2332 is deleted from the employees table, then Oracle sets to null the value of manager_id for all employees in the dept_20 table who previously had manager 2332.Because of the second ON DELETE clause, Oracle cascades any deletion of a department_id value in the departments table to the department_id values of its dependent rows of the dept_20 table. For example, if Department 20 is deleted from the departments table, then Oracle deletes all of that department's employees from the dept_20 table.
      

  2.   

    楼上正解。这是表的表键,表示删除主表departments数据的时候会删除对应的数据 CONSTRAINT fk_deptno 
                        REFERENCES departments(department_id) 
                        ON DELETE CASCADE );
      

  3.   

    表結構腳本如下
    主表:
    CREATE TABLE "GEORGE"."PLLL"
       ( "PLLL_DH" CHAR(8) NOT NULL ENABLE,
    "PLLL_RQ" DATE NOT NULL ENABLE,
    "PLLL_QLDH" CHAR(8) NOT NULL ENABLE,
    "PLLL_LLDW" CHAR(8) NOT NULL ENABLE,
    "PLLL_CC" NUMBER(10,2) NOT NULL ENABLE,
    "PLLL_LLRU" CHAR(6),
    "PLLL_FLRU" CHAR(6),
    "PLLL_HZGH" CHAR(6),
    "PLLL_HZBZ" VARCHAR2(30),
    "PLLL_CDRU" CHAR(6) NOT NULL ENABLE,
    "PLLL_CDRQ" DATE NOT NULL ENABLE,
    "PLLL_QR" CHAR(1) DEFAULT 'Y' NOT NULL ENABLE,
    "PLLL_BZ" VARCHAR2(30),
     PRIMARY KEY ("PLLL_DH")
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
      STORAGE(INITIAL 2932736 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "GEORGE"  ENABLE
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 14745600 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "GEORGE"從表:
     CREATE TABLE "GEORGE"."PLLLMX"
       ( "PLLLMX_DH" CHAR(8) NOT NULL ENABLE,
    "PLLLMX_PLBH" CHAR(18) NOT NULL ENABLE,
    "PLLLMX_ZH" NUMBER(4,0) NOT NULL ENABLE,
    "PLLLMX_CC" NUMBER(8,2) NOT NULL ENABLE,
    "PLLLMX_SL" NUMBER(3,0) NOT NULL ENABLE,
    "PLLLMX_UY" CHAR(2) DEFAULT '2' NOT NULL ENABLE,
     PRIMARY KEY ("PLLLMX_DH", "PLLLMX_PLBH", "PLLLMX_ZH", "PLLLMX_CC")
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
      STORAGE(INITIAL 49741824 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "GEORGE"  ENABLE,
     FOREIGN KEY ("PLLLMX_DH")
      REFERENCES "GEORGE"."PLLL" ("PLLL_DH") ON DELETE CASCADE ENABLE
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 22110208 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "GEORGE"
    在從表裡加了外鍵,並且On cascade enable,就可以了。