Cannot update user_sdo_geom_metadata when creating spatial database in oracle

i used the oracle 11g and tried to create a spatial database, I just copied the sample code from the oracle document but when it comes to updating part of the metadata, it gave a duplicate input error and I tried delete from user_sdo_geom_metadata and it did not give any error and then tried to paste again, still got a duplicate input error. I also tried select * from user_sdo_geom_metadata , but received nothing. Does anyone have an idea why? thanks

Code example:

 CREATE TABLE cola_markets ( mkt_id NUMBER PRIMARY KEY, name VARCHAR2(32), shape SDO_GEOMETRY); INSERT INTO cola_markets VALUES( 1, 'cola_a', SDO_GEOMETRY( 2003, -- two-dimensional polygon NULL, NULL, SDO_ELEM_INFO_ARRAY(1,1003,3), -- one rectangle (1003 = exterior) SDO_ORDINATE_ARRAY(1,1, 5,7) -- only 2 points needed to -- define rectangle (lower left and upper right) with -- Cartesian-coordinate data )); INSERT INTO user_sdo_geom_metadata (TABLE_NAME, COLUMN_NAME, DIMINFO, SRID) VALUES ( 'cola_markets', 'shape', SDO_DIM_ARRAY( -- 20X20 grid SDO_DIM_ELEMENT('X', 0, 20, 0.005), SDO_DIM_ELEMENT('Y', 0, 20, 0.005) ), NULL -- SRID ); 

cause of error: in user_sdo_geom_metadata view, there are two duplicate entries for a pair of table values ​​and a value table.

+5
source share
1 answer

To be sure, what shows the following?

 SELECT * FROM USER_SDO_GEOM_METADATA; 

The names of objects in dictionary representations are stored in upper case. Therefore, if you want to remove existing records from spatial metadata, you need to do this (note the name of the uppercase table):

 DELETE FROM USER_SDO_GEOM_METADATA WHERE TABLE_NAME = 'COLA_MARKETS'; COMMIT; 
+4
source

Source: https://habr.com/ru/post/1206135/


All Articles