发布网友 发布时间:2022-04-10 23:49
共5个回答
懂视网 时间:2022-04-11 04:10
table USERINFO; create table USERINFO ( EnglishName varchar(30), ChineseName varchar(30), Sex varchar(10), Age int, BirthPlace varchar(100), BirthDate date default sysdate );上面的方式有个缺陷,如果表不存在,那么会drop语句会报错
ORA-00942: table or view does not exist
更加优秀的执行方式:
declare w_count int; w_name varchar(20); begin w_name:=‘USERINFO‘; select count(*) into w_count from user_tables where table_name = w_name; if(w_count>0) then execute immediate ‘drop table USERINFO‘; end if; execute immediate ‘create table USERINFO ( EnglishName varchar(30), ChineseName varchar(30), Sex varchar(10), Age int, BirthPlace varchar(100), BirthDate date default sysdate )‘; end;
Oracle表存在则删除后再重建
标签:view nbsp arch acl chinese rom rop 执行 name
热心网友 时间:2022-04-11 01:18
drop tablespace tbsname include contents and datafiles;热心网友 时间:2022-04-11 02:36
drop tablespace xxxx including contents and datafiles ;热心网友 时间:2022-04-11 04:11
用这个热心网友 时间:2022-04-11 06:02
重新建个新的不就完了