现在的位置: 首页 > 综合 > 正文

oracle 游标循环删除表数据 sql

2013年09月08日 ⁄ 综合 ⁄ 共 397字 ⁄ 字号 评论关闭

 

  declare
  cursor table_user is
    select table_name      from user_tables     where table_name not like 'resthome';
   table_name varchar(40);
begin
  open table_user;
  fetch table_user
    into table_name;

  while table_user%found

   loop
    --dbms_output.put_line('delete from '||table_name);
    ---执行拼接字符串
    execute immediate  'delete from '||table_name;
    fetch table_user
      into table_name;
  end loop;
  close table_user;
  commit;
end;

抱歉!评论已关闭.