OCN 通過遊標刪除9個小區的數據

declare 
    v_TableName user_tables.Table_name%type;
    v_Sql varchar2(4000);
    cursor mycursor is select Table_name from user_tables where Table_name like upper('sage_td_estate_%');
begin
     open mycursor;
     if mycursor%isopen
     then
         loop
             fetch mycursor into v_TableName;
             exit when mycursor%notfound;
             v_Sql:='truncate table '||v_TableName;
             --dbms_output.put_line(v_Sql);
             execute immediate v_SQL;
         end loop;
     else 
         dbms_output.put_line('no data');
     end if;
     close mycursor;
end;


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章