pl/sql里面?begin
execute immediate 'create table tbname ...';
exception when others then
null;--表已经存在
end;
execute immediate 'create table tbname ...';
exception when others then
null;--表已经存在
end;
2 strsql varchar2(100);
3 count1 number(1);
4 begin
5 select count(*) into count1 from user_tables where table_name='TEST';
6 if count1>0 then
7 strsql:='Drop table TEST';
8 execute immediate strsql;
9 end if;
10 end;
2 strsql varchar2(100);
3 count1 number(1);
4 begin
5 select count(*) into count1 from user_tables where table_name='TEST';
6 if count1=0 then
7 strsql:='create table TEST(a varchar2(20))';
8 execute immediate strsql;
9 else
10 dbms_output.put_line('表存在');
11 end if;
12 end;
13 /PL/SQL 过程已成功完成。SQL> /
表存在PL/SQL 过程已成功完成。SQL>