oracle spatial 创建空间字段索引 创建字段索引 完善SQL语句实例二

时间:2021-09-13 01:03:15
//创建空间字段索引 oracle spatial table
//======================================
drop index index_sp_v_gbjj;
drop index index_sp_v_xzq;
drop index index_sp_v_ytfq;
drop index index_sp_v_dltb;
drop index index_sp_v_nydfddj;


create index index_sp_v_gbjj        on v_gb_gdbhdk_h(geometry)        indextype is  mdsys.spatial_index;
create index index_sp_v_xzq         on v_jj_xzq_h(geometry)           indextype is  mdsys.spatial_index;
create index index_sp_v_ytfq        on v_tdlygh_ytfq_xz_e(geometry)   indextype is  mdsys.spatial_index;
create index index_sp_v_dltb        on v_tdlyxz_dltb_h(geometry)      indextype is  mdsys.spatial_index;
create index index_sp_v_nydfddj     on v_tdly_nydfddj_k(geometry)     indextype is  mdsys.spatial_index;
//======================================


//创建字段索引
//=======================================
drop   index index_fd_v_gbjj_xzqdm;
drop   index index_fd_v_xzq_xzqdm;
drop   index index_fd_v_ytfq_xzqdm;
drop   index index_fd_v_dltb_zldwdm;
drop   index index_fd_v_nydfddj_xzdm;


create index index_fd_v_gbjj_xzqdm           on v_gb_gdbhdk_h(xzqdm);
create index index_fd_v_xzq_xzqdm            on v_jj_xzq_h(xzqdm);
create index index_fd_v_ytfq_xzqdm           on v_tdlygh_ytfq_xz_e(xzqdm);
create index index_fd_v_dltb_zldwdm          on v_tdlyxz_dltb_h(zldwdm);
create index index_fd_v_nydfddj_xzdm         on v_tdly_nydfddj_k(xzdm);
//=======================================
//创建FID字段唯一性约束
alter table v_gb_gdbhdk_h drop constraint index_uk_v_gbjj_fid cascade;
alter table v_gb_gdbhdk_h add  constraint index_uk_v_gbjj_fid unique(fid);


alter table v_jj_xzq_h drop constraint index_uk_v_xzq_fid cascade;
alter table v_jj_xzq_h add  constraint index_uk_v_xzq_fid unique(fid);


alter table v_tdlygh_ytfq_xz_e drop constraint index_uk_v_ytfq_fid cascade;
alter table v_tdlygh_ytfq_xz_e add  constraint index_uk_v_ytfq_fid unique(fid);


alter table v_tdlyxz_dltb_h drop constraint index_uk_v_dltb_fid cascade;
alter table v_tdlyxz_dltb_h add  constraint index_uk_v_dltb_fid unique(fid);


alter table v_tdly_nydfddj_k drop constraint index_uk_v_nydfddj_fid cascade;
alter table v_tdly_nydfddj_k add  constraint index_uk_v_nydfddj_fid unique(fid);

//=======================================

--the--end---