1. 如果表存在,就删除表
a integer;
Begin
select count(*) into a from user_tables t where TABLE_NAME =upper('表名');
if a = 1 then
execute immediate 'drop table 表名';
end if;
2. 如果表不存在,就创建表
a integer;
Begin
select count(*) into a from user_tables t where TABLE_NAME =upper('表名');
if a = 0 then
execute immediate 'create table 表名
(
guid VARCHAR2(32) not null,
columncode VARCHAR2(50),
columnname VARCHAR2(100),
datatype VARCHAR2(3),
tablecode VARCHAR2(30),
ordercode INTEGER,
orgin VARCHAR2(100)
)';
end if;
3,插入信息
begin
delete from GCFR_T_REPCOLUMN_BASICDATA;
insert into 表名(guid, columncode, columnname, datatype, tablecode, ordercode, orgin)
values ('7AEE936E2F2249A0803E28713CEEF510', '区划', '区划', 'S', 'GCFR_V_REPORTGATHER_BM', 1, null);
insert into 表名(guid, columncode, columnname, datatype, tablecode, ordercode, orgin)
values ('2C5C4579BDD74238BDCD732126BE0A10', '地区', '地区', 'S', 'GCFR_V_REPORTGATHER_BM', 2, null);