create or replace procedure simo_pro as
begin
declare   
  isHas number; 
  cursor table_input(varchar inid) is
  select id,name from simo_tab where id = inid
begin   
  select   count(1)   into   isHas   from   user_tables   where   table_name='大写表名';   
  if   isHas>0   then   
  execute   immediate   'delete  table   '||'大写表名';   --删除表数据
  end   if;   
  execute   immediate   'create   table....';   --创建表
  
   open table_input('1') ;--传入参数
         loop
           fetch base_stu_in into stu_in;
           exit when base_stu_in%NOTFOUND;
           begin
             ...   --你的数据插入操作
           end;
         end loop;
    close table_input;
end;
end simo_pro;   

解决方案 »

  1.   

    游标循环里面 exit when 写错了,改为create or replace procedure simo_pro as
    begin
    declare   
      isHas number; 
      cursor table_input(inid varchar2) is
      select id,name from simo_tab where id = inid;
      input table_input%ROWTYPE;
    begin   
      select   count(1)   into   isHas   from   user_tables   
       where   table_name='大写表名';   
      if   isHas>0   then   
      execute   immediate   'delete  table   '||'大写表名';   --删除表数据
      end   if;   
      execute   immediate   'create   table....';   --创建表
      
       open table_input('1') ;--传入参数
             loop
               fetch table_input into input;
               exit when table_input%NOTFOUND;
               begin
                 ...;   --你的数据插入操作
               end;
             end loop;
        close table_input;
    end;
    end simo_pro;   
      

  2.   

    存储过程放入多条sql语句如何实现并行,批处理功能?初涉存储过程,求学习流程