【问题标题】:SQL syntax error in creating spatial network创建空间网络时的 SQL 语法错误
【发布时间】:2013-03-16 23:44:55
【问题描述】:

我正在尝试从使用 FME Desktop 导入 Oracle DB 的 shapefile(代表街道中心线)创建空间网络。 “CENTRELINES”空间对象包含一个 GEOM 列,我想将其用作网络分析的基础,以根据路线距离作为成本属性在养老院(点)之间分配救护车设施(点)。欢迎任何有关在 Oracle Spatial 中解决这个病态问题的方法的建议,但主要问题是我是 SQL 的初学者。我使用 Oracle 的documentation 编写了以下 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
SDO_NET.CREATE_LRS_NETWORK(
  'LRS_net', 
  'CENTRELINES', 
  'GEOM', 
  1, 
  FALSE, 
  TRUE);
end;

感谢您的帮助!

【问题讨论】:

  • 我添加了开始/结束语法:
  • 第8行需要加分号。将TRUE)改为TRUE);

标签: sql oracle networking spatial oracle-spatial


【解决方案1】:

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

如果您的 EXECUTE 命令由于 PL/SQL 而不能放在一行中 语句,请使用 SQL*Plus 连续字符(连字符)。

它实际上试图在后台运行的是翻译

BEGIN
    SDO_NET.CREATE_LRS_NETWORK(;
END;
/

... 这(可能显然是这样写的)不是有效的 PL/SQL。与空间调用本身无关。如果您确实想将其拆分为多行,则可以使用显式 begin/end 而不是简写 exec

第二个问题可能表明您已经多次运行短版本,尽管它不是我非常熟悉的功能;但与最初的分号错误无关。 (另外,结束 SQL 语句并不严格需要分号,但这是另一个细节......)。

【讨论】:

    猜你喜欢
    • 2021-04-29
    • 1970-01-01
    • 1970-01-01
    • 2018-09-12
    • 2023-04-08
    • 1970-01-01
    • 2019-11-14
    • 1970-01-01
    • 2019-05-03
    相关资源
    最近更新 更多