增加一个Ado数据库连接和一个ado数据库查询,打开连接后在查询中一条条执行删除语句,再提交。
类似:
      with adoConn do
         begin
            ConnectionString := cnString;
            Open;
            Connected := true;
         end;
   with adoQuery do
      begin
         close;
         sql.Clear;
         sql.Add('delete from tablename1');
         execsql;
         close;
         sql.Clear;
         sql.Add('delete from tablename2');
         execsql;
         ...... 
      end;

解决方案 »

  1.   

    需要外键:
     alter table b
      2  add constraint fk_b_a foreign key (id,dep,birthday)
      3  references a (id,dep,birthday)
      4  on delete cascade
      5  /
      

  2.   

    补充说明:
    SQL> create table a
      2  (id       varchar2(10),
      3   dep      varchar2(10),
      4   birthday date,
      5   name     varchar2(10),
      6   constraint pk_a primary key (id,dep,birthday))
      7  /
    Table created.SQL> create table b
      2  (id       varchar2(10),
      3   dep      varchar2(10),
      4   birthday date,
      5   sal      number(10))
      6  /
    Table created.SQL> alter table b
      2  add constraint fk_b_a foreign key (id,dep,birthday)
      3  references a (id,dep,birthday)
      4  on delete cascade
      5  /
    Table altered.
    不能更新