你的意思就是说要重新创建A表.在ORACLE中,不用这么判断.直接用CREATE OR REPLACE语句创建表,这样,既可以保留A表原有的权限,也可以使依赖该表的所有对象有效.如果是删除后再创建该表的话,则依赖于该表的所有对象都会无效,赋予别的用户的权限也要重新再赋予.
直接用CREATE OR REPLACE语句创建表?没有这种写法的吧 select count(1) into v_counter from dba_tables where table_name='' and owner='' if v_counter=0 then v_sql:='create table tableName..' execute immediate v_sql; end if;
declare n number; v_sql varchar(200); begin select count(*) into n from user_tables where table_name = UPPER('your_table'); if n>0 then execute immediate 'drop table your_table'; end if;
select count(1) into v_counter from dba_tables where table_name='' and owner=''
if v_counter=0 then
v_sql:='create table tableName..'
execute immediate v_sql;
end if;
declare
n number;
v_sql varchar(200);
begin
select count(*) into n from user_tables where table_name = UPPER('your_table');
if n>0 then
execute immediate 'drop table your_table';
end if;
v_sql := 'create table your_table(col1 varchar2(10),col2 varchar2(20))';
execute immediate v_sql;
exception
when others then
null;
end;