CREATE VIEW bd_nearest_hy AS
SELECT b1.b_name, h1.h_id
FROM building b1,hydrant h1
WHERE sdo_nn(h1.shape, b1.shape,'sdo_num_res = 1') = 'TRUE';
SELECT bd_nearest_hy.b_name
FROM bd_nearest_hy
WHERE bd_nearest_hy.h_id = 'p30';
我创建了一个视图,用于存储建筑物名称及其相应的最近的消防栓。 sdo_nn语句工作正常,视图正确。
但是,当我从视图中选择包含h_id = p30
的行时,数据库会说:
错误报告:
SQL Error: ORA-13249: SDO_NN cannot be evaluated without using index
ORA-06512: at "MDSYS.MD", line 1723
ORA-06512: at "MDSYS.MDERR", line 17
ORA-06512: at "MDSYS.PRVT_IDX", line 9
它出了什么问题?