oracle清空所有表数据
程序员文章站
2022-06-29 14:29:44
方法:
1. 删除所有外键约束
2. drop表
3. 添加外键约束
代码使用powerdesign生成
/*======================...
方法:
1. 删除所有外键约束
2. drop表
3. 添加外键约束
代码使用powerdesign生成
/*==============================================================*/ /* dbms name: oracle version 10g */ /* created on: 2013/8/16 14:30:03 */ /*==============================================================*/ alter table da_pic drop constraint fk_da_pic_reference_da_picsu; drop table da_pic cascade constraints; drop table da_picsubject cascade constraints; /*==============================================================*/ /* table: da_pic */ /*==============================================================*/ create table da_pic ( id varchar2(200) not null, no varchar2(200), subjiectid varchar2(200), name varchar2(400), uploadtime date, userid varchar2(200), picdate date, place varchar2(200), people varchar2(200), event varchar2(200), background varchar2(200), cameramen varchar2(200), serial integer, iseffect varchar2(200), constraint pk_da_pic primary key (id) ); /*==============================================================*/ /* table: da_picsubject */ /*==============================================================*/ create table da_picsubject ( id varchar2(200) not null, no varchar2(200), title varchar2(200), year varchar2(200), type varchar2(200), gdtime date, iseffect varchar2(200), seiral integer, constraint pk_da_picsubject primary key (id) ); alter table da_pic add constraint fk_da_pic_reference_da_picsu foreign key (subjiectid) references da_picsubject (id);