sql

SET SERVEROUTPUT ON;

DECLARE
LNAME VARCHAR2(200);
BEGIN
FOR X IN (select TABLE_NAME from user_tables
where table_name like 'SYMPHONY%'
) LOOP
LNAME:= X.TABLE_NAME;
EXECUTE IMMEDIATE 'DROP TABLE '|| X.TABLE_NAME ;
END LOOP;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.put_line(LNAME);
RAISE;
END;
/

执行结果

SQL> SET SERVEROUTPUT ON;
SQL> DECLARE
  2  LNAME VARCHAR2(200);
  3  BEGIN
  4  FOR X IN (select TABLE_NAME from user_tables
  5  where table_name like 'SYMPHONY%'
  6  ) LOOP
  7  LNAME:= X.TABLE_NAME;
  8  EXECUTE IMMEDIATE 'DROP TABLE '|| X.TABLE_NAME ;
  9  END LOOP;
 10  EXCEPTION
 11  WHEN OTHERS THEN
 12  DBMS_OUTPUT.put_line(LNAME);
 13  RAISE;
 14  END;
 15  /


PL/SQL procedure successfully completed
Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐