SQL篇
时间:2022-03-15 15:15
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;