delete from TBLA a where (a_col, b_col) in (select a_col,b_col from TBLB)
不知道速度会快多少,试一下

解决方案 »

  1.   

    to lyid(空心菜) :
    in比exists慢
      

  2.   

    若想快,还是以过程调用好declare
    str varchar(100);
    begin
    str:='delete from TBLA a where (a_col, b_col) in (select a_col,b_col from TBLB)';
    execute immediate str;
    end;
    /
    注意:先赋权限  grant delete any table to user_name;
      

  3.   

    declare
    str varchar(100);
    begin
    str:='delete from TBLA a where exists 
    (select 'x' from TBLB where a_col=a.a_col and b_col=a.b_col)';
    execute immediate str;
    end;
      

  4.   

    DELETE FROM A WHERE
    A_COL IN (SELECT A_COL,B_COL FROM A
    INTERSECT
    SELECT A_COL,B_COL FROM B);
      

  5.   

    还有比触发器更快的吗?
    当B表存在删A,OVER。