//建表
declare v_count int;
begin
select count(*) into v_count from user_tables where table_name=UPPER(‘XXX’);
if v_count = 0 then execute immediate
‘create table XXX(
–字段属性定义–
)’;
end if;
end;
/
//建索引
declare v_count int;
begin
select count(*) into v_count from user_ind_columns where index_name=UPPER(‘XXX’);
if v_count = 0 then execute immediate
‘create index XXX on XXXX(XX)’;
end if;
end;
/