简体   繁体   中英

Oracle “sdo_net_mem.network_manager.shortest_path” code not working

I tried to create a spatial network in oracle Sql developer Client Editor; When I tried to this code, its gave me "True" result;

SELECT SDO_NET.NETWORK_EXISTS('network_name') FROM DUAL;

it means SDO_NET commands are working properly.

But, When I tried to this code;

DECLARE
  cost NUMBER;
  path_id NUMBER;
  res_numeric NUMBER;
BEGIN
   path_id := sdo_net_mem.network_manager.shortest_path('network_name',source_node_id, dest_node_id);
   cost := SDO_NET_MEM.PATH.GET_COST('network_name', path_id);
   DBMS_OUTPUT.PUT_LINE('The ID of the shortest path from X to Y is: ' || path_id || ' and it costs ' || cost);
END;

Gave me that result;

在此处输入图片说明

How I can solve this; Thanks.

Did you load the network first ? You do that using the SDO_NET_MEM.NETWORK_MANAGER.READ_NETWORK() procedure. In your case:

SDO_NET_MEM.NETWORK_MANAGER.READ_NETWORK('network_name', 'TRUE');

Note that the SDO_NET_MEM package has been deprecated in 12c and should no longer be used.

Try running this procedure to check your network

select SDO_NET.VALIDATE_NETWORK('network_name') from dual;

what is your oracle version?

Normally we execute the read network before running any network methods.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM