Oracle 的drop table if exists功能

Mysql 創建表之前判斷表是否存在,如果存在則刪除已有表

DROP TABLE IF EXISTS SH_PLACARD_INFO;

Oracle 創建表之前判斷表是否存在,如果存在則刪除已有表

declare
      num number;
begin
    select count(1) into num from user_tables where table_name = upper('SH_PLACARD_INFO') ;
    if num > 0 then
        execute immediate 'drop table SH_PLACARD_INFO' ;
    end if;
end;
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章