我写了这个存储过程,结果报错,是怎么回事?
正确的写法是什么?
分不够加点就是。存储过程:
-------------------------
begin
  drop table table1;
  create table table1 as (select * from table2);
end;
-------------------------报错内容如下:
-------------------------
ORA-06550: 第 2 行, 第 1 列: 
PLS-00103: 出现符号 "DROP"在需要下列之一时:
 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在 "DROP" 继续之前已插入。
ORA-06550: 第 2 行, 第 33 列: 
PLS-00103: 出现符号 ";"在需要下列之一时:
 . , @ in <an identifier>
   <a double-quoted delimited-identifier> partition subpartition
-------------------------

解决方案 »

  1.   

    insert into table1 select * from table2
    如果在存储过程里写,需要
    execute immediate 'insert into table1 select * from table2'
    楼主的存储过程也要这样
    execute immediate 'drop table table1';
    execute immediate 'create table table1 as (select * from table2)';
      

  2.   

    SmallHand(火龍) ,我正在学这方面的内容,自己现在还写不来。所以帖子结不了。