小弟新手刚学习Oracle
之前解除的都是Sql求个简单的建表脚本  如果表格存在则删除表格 这样if exists(select * from sys.objects where name=N'name')
   drop table name
go
类似这样的  谢谢先

解决方案 »

  1.   

    begin
    execute immediate ' drop table 表名';
    exception when others then
    null;
    end;
      

  2.   

    不用判断,直接drop再create就行了,反正不管.
      

  3.   

    drop table tableName;--这里会提示没有找到表的错误,不用管继续
    create table tableName
    (
    );这样就可以了。
      

  4.   

    declare
    v_count number;
    begin
      select count(1) into v_count from  sys.objects where upper(name)=upper(表名称);
      if v_count!=0 then
        execute immediate 'drop table :tablename;'
        using 表名称;
      end if;
    end;
      

  5.   

    drop table s_userinfo ;
    create table s_userinfo
    (
    userid varchar(3) not null primary key ,
    uname varchar(10) not null ,
    sex varchar(2) not null ,
    age number(3) not null ,
    email varchar(30) not null 
    ) ;insert into s_userinfo values('001','刘德华','女',70,'[email protected]') ;
    insert into s_userinfo values('002','小犬什么郎','女',50,'[email protected]') ;
    insert into s_userinfo values('003','张曼玉','女',50,'[email protected]') ;