建立aa.sql
将多个sql写里面
在plus *sql 中执行@aa.sql

解决方案 »

  1.   

    luyuen(滋味)
    每个语句间用什么分割符阿?好像;是不行的!
      

  2.   

    declare
    str varchar2(100);
    begin
    str:='begin drop table a; create table a(ID varchar2(1)); end;';
    execute immediate str;
    end;
    /
      

  3.   

    提示错误:declare
    *
    ERROR 位于第 1 行:
    ORA-06550: 第 1 行, 第 8 列:
    PLS-00103: 出现符号 "CREATE"在需要下列之一时:
    begin case declare exit
    for goto if loop mod null pragma raise return select update
    while with <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> <<
    close current delete fetch lock insert open rollback
    savepoint set sql execute commit forall merge
    <a single-quoted SQL string> pipe
    符号 "lock在 "CREATE" 继续之前已插入。
    ORA-06550: 第 1 行, 第 30 列:
    PLS-00103: 出现符号 "("在需要下列之一时:
    . , @ in <an identifier>
    <a double-quoted delimited-identifier> partition subpartition
    ORA-06550: 第 1 行, 第 48 列:
    PLS-00103: 出现符号 "DROP"在需要下列之一时:
    begin function package
    pragma procedure subtype type use <an identifier>
    <a double-quoted delimited-identifier> form current cursor
    ORA-06512: 在line 5
      

  4.   

    用SQL*PLUS WORKSHEET,可以很方便的调试,我不知道SQL*PLUS有啥用,还请教教我
      

  5.   

    直接复制后粘贴即可实现多条sql执行
      

  6.   

    做一个.sql的文件在里面写SQL语句
    在sqlplus里执行
    @ 路径名/文件名
      

  7.   

    SQL> declare
      2   cursor t_sor is
      3   select table_name from user_tables;
      4   str varchar2(100);
      5  begin
      6   str:='begin ';
      7   for v_sor in t_sor loop
      8   str:=str||'begin execute immediate ''drop table '||v_sor.table_name||''';end;';
      9   end loop;
     10   str:=str||' end;';
     11   execute immediate str;
     12  end;
     13  /PL/SQL procedure successfully completed大家明白了吗?就是在pl/sql不能直接进行ddl操作.