当前位置:Gxlcms > 数据库问题 > SQL篇

SQL篇

时间:2021-07-01 10:21:17 帮助过:3人阅读

declare n_cnt number;
begin
---查询要创建的表示否存在
select count(*) into n_cnt from user_tables where tablename=‘A‘;
---如果存在
if n_cnt>0 then
dbms_output.put_line(‘删除A表!‘);
execute immediate ‘drop table "A"‘;
--否则
else
dbms_output.put_line(‘删除B表!‘);
execute immediate ‘drop table "B"‘;
end if;
execute immediate ‘CREATE TABLE "A" ( "ID" VARCHAR2(10), "NAME" VARCHAR2(10) )‘;
end;

SQL篇

标签:output   imm   The   HERE   dia   exec   from   count   where   

人气教程排行