oracle 存储过程

示例

create or replace procedure pro_droptable AUTHID CURRENT_USER is
cursor cur_table is select table_name from tabs;
cursor cur_sequence is select sequence_name from seq;
drop_sql varchar2(1000);
begin
  for tbname in cur_table loop
    begin
      drop_sql:='drop table '||tbname.table_name||' cascade constraints';
      execute immediate drop_sql;
    end;
  end loop;
  
  for sqname in cur_sequence loop
    begin
      drop_sql:='drop sequence '||sqname.sequence_name;
      execute immediate drop_sql;
    end;
  end loop;

end pro_droptable;
/

call pro_droptable();


* sqlplus中加载存储过程:

     @./procedue.sql


你可能感兴趣的:(oracle 存储过程)