Yet in your post you are:
CREATE INDEX ELKORDY.BUILDING_SPATIAL_IDX ON ELKORDY.BUILDING(BUILDING_POLYGON) INDEXTYPE IS MDSYS.SPATIAL_INDEX;
CREATE INDEX HHLT.BUILDING_SPATIAL_IDXSorry, which is it?
alter session set current_schema = HHLT;Didn't connect as you expected - you are still the SYS user - so that when you did this:
It associated the metadata with the SYS owner and not the HHLT owner hence the error when creating the index.
INSERT INTO USER_SDO_GEOM_METADATA VALUES ('BUILDING', 'BUILDING_POLYGON', SDO_DIM_ARRAY( SDO_DIM_ELEMENT('X', 0, 820, 0.005), SDO_DIM_ELEMENT('Y', 0, 580, 0.005)), NULL);