Oracle creates spatial index __oracle

Source: Internet
Author: User
Tags create index
After a period of study, I will now share my experience on the establishment of spatial indexes as follows. If the data is imported from someone else's library, if a space index was previously built, then you need to delete it to establish your own spatial index (otherwise it will be easy to make an error), if it is entirely your own data, or before you have not established a spatial index that can be directly established.
First, the query to determine whether the data has been established corresponding spatial metadata
SELECT * from User_sdo_geom_metadata t where t.sdo_table_name like '% table name% ';
If there is a connection with your watch, please delete it.
SELECT * from User_ind_columns t where t.index_name= ' index name ';
Then the spatial index can be established, and the spatial metadata is established first, and the statement is as follows.
INSERT into Mdsys.sdo_geom_metadata_table (Sdo_owner,sdo_table_name,sdo_column_name,sdo_diminfo,sdo_srid)
  VALUES (' Table space ', ' table name ', ' GEOM ' (space field name) ',
    Mdsys. Sdo_dim_array
      (Mdsys. Sdo_dim_element (' X ', -180.0, 180.0, 0.00005),
       Mdsys. Sdo_dim_element (' Y ', -90.0,90.0, 0.00005)
     ),
NULL);
Establishes user metadata.
INSERT into User_sdo_geom_metadata (table_name, COLUMN_NAME, Diminfo, SRID)
 VALUES (' table name ', ' Real_geom (space field name) ',
    Mdsys. Sdo_dim_array
      (Mdsys. Sdo_dim_element (' X ', -180, 180, 0.00000000050),
       Mdsys. Sdo_dim_element (' Y ', -90, N, 0.00000000050)),
     NULL);


Create an index
CREATE index index name on table name (field name) Indextype is Mdsys. Spatial_index;

If you cannot create a success, the general situation is that the previous library results have already created the space index, just to delete the previously indexed items.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.