小弟新手刚学习Oracle
之前解除的都是Sql求个简单的建表脚本 如果表格存在则删除表格 这样if exists(select * from sys.objects where name=N'name')
drop table name
go
类似这样的 谢谢先
之前解除的都是Sql求个简单的建表脚本 如果表格存在则删除表格 这样if exists(select * from sys.objects where name=N'name')
drop table name
go
类似这样的 谢谢先
execute immediate ' drop table 表名';
exception when others then
null;
end;
create table tableName
(
);这样就可以了。
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;
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]') ;