创建空间网络时出现SQL语法错误



我试图从一个shapefile(代表街道中心线)导入到Oracle DB与FME桌面创建一个空间网络。"CENTRELINES"空间对象包含一个GEOM列,我想将其用作网络分析的基础,以便根据路线距离作为成本属性在养老院(点)之间分配救护车设施(点)。任何关于在Oracle Spatial中解决这个病态问题的方法建议都是受欢迎的,但主要问题是我是SQL的初学者。我使用Oracle的文档编写了以下SQL语句:

-- create an LRS geometry network
EXEC SDO_NET.CREATE_LRS_NETWORK(
  'LRS_net', -- network name
  'CENTRELINES', -- LRS geometry table name
  'GEOM', -- LRS geometry column name
  1, -- number of hierarchy levels
  FALSE, -- directed link?
  TRUE -- node with cost?
  );

脚本输出如下内容:

Error starting at line 2 in command:
EXEC SDO_NET.CREATE_LRS_NETWORK(
Error report:
ORA-06550: line 1, column 34:
PLS-00103: Encountered the symbol ";" when expecting one of the following:
   ( ) - + case mod new not null <an identifier>
   <a double-quoted delimited-identifier> <a bind variable>
   table continue avg count current exists max min prior sql
   stddev sum variance execute multiset the both leading
   trailing forall merge year month day hour minute second
   timezone_hour timezone_minute timezone_region timezone_abbr
   time timestamp interval date
   <a string literal with character set specification>
06550. 00000 -  "line %s, column %s:n%s"
*Cause:    Usually a PL/SQL compilation error.
*Action:
...
Error starting at line 9 in command:
)
Error report:
Unknown Command

我知道第2行产生了错误:

PLS-00103: Encountered the symbol ";" when expecting one of the following...

考虑到分号需要结束SQL查询,为什么这是一个问题?

编辑:下面的脚本通过添加begin/end来生成网络:

begin
SDO_NET.CREATE_LRS_NETWORK(
  'LRS_net', 
  'CENTRELINES', 
  'GEOM', 
  1, 
  FALSE, 
  TRUE);
end;

谢谢你的帮助!

如文档中所述,SQL*Plus execute命令通常必须在一行中输入:

如果你的EXECUTE命令因为PL/SQL错误而不能放在一行语句时,使用SQL*Plus连续字符(连字符)。

它实际上试图在底层运行的是作为

的翻译
BEGIN
    SDO_NET.CREATE_LRS_NETWORK(;
END;
/

…这是(可能很明显,当这样写)无效的PL/SQL。与空间调用本身无关。如果你想把它分成多行,你可以使用显式的begin/end而不是简写的exec

第二个问题可能表明你已经运行了不止一次的短版本,虽然这不是一个我很熟悉的功能;但与最初的分号错误无关。(另外,结束SQL语句并不一定需要分号,但这是另一个细节…)

相关内容

最新更新