您的位置:首页 > 博客中心 > 数据库 >

ORACLE—003:Create之创建表前判断表是否存在

时间:2022-03-10 17:31

建表前如何判断表是否存在呢,因为table是不支持replace的。下面的sql能帮到你。

create前先判断表是否存在。例如,如果存在则drop掉那个表。当然你也可以定义自己的操作。

 declare
   v_cnt Number; 
begin 

    select count(*) into v_cnt  from user_tables where upper(table_name) like ‘%TMP_CLOB_SQL%‘; 

    if v_cnt>0 then 
       execute immediate ‘DROP TABLE TMP_CLOB_SQL‘;
    end If; 
End;
/
create table youttable
(
)
注意:别忘了加斜杠。

ORACLE—003:Create之创建表前判断表是否存在,布布扣,bubuko.com

热门排行

今日推荐

热门手游