本文介绍了创建空间网络时出现SQL语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用导入到FME Desktop的Oracle DB中的shapefile(代表街道中心线)创建空间网络. "CENTRELINES"空间对象包含一个GEOM列,我想以此为基础进行网络分析,以基于路线距离作为成本属性在救护院(点)之间分配救护车设施(点).欢迎提供有关在Oracle Spatial中解决此病态问题的方法的任何建议,但主要问题是我是SQL的初学者.我已经使用了Oracle的文档组成以下SQL语句:

I am trying to create a spatial network from a shapefile (representing street centrelines) imported into an Oracle DB with FME Desktop. The 'CENTRELINES' spatial object contains a GEOM column that I'd like to use as the basis for a network analysis to allocate ambulance facilities (points) among retirement homes (points) based on route distance as a cost attribute. Any advice on methodology for approaching this morbid problem in Oracle Spatial would be welcome, but the main issue is that I am a beginner at SQL. I've used Oracle's documentation to compose the following SQL statement:

-- 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

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

I understand that line 2 is producing the error:

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

鉴于结束SQL查询需要使用分号,这是为什么呢?

Given that semi-colons are required to end an SQL query, why is this a problem?

以下脚本通过添加开始/结束来产生网络:

The following script produced the network by adding begin/end:

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

谢谢您的帮助!

推荐答案

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

As noted in the documentation, the SQL*Plus execute command normally has to be entered on one line:

实际上试图将其翻译为

BEGIN
    SDO_NET.CREATE_LRS_NETWORK(;
END;
/

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

... which is (maybe obviously when written like that) not valid PL/SQL. Nothing to do with the spatial call per se. If you do want to split it onto multiple lines, you can just use an explicit begin/end rather than the shorthand exec.

第二个问题可能表明您已经多次运行了简短版本,尽管它不是我非常熟悉的功能.但与初始分号错误无关. (而且,严格地不需要使用分号来结束 SQL 语句,但这是下一次的细节...).

The second problem maybe suggests that you've run the short version more than once, though it isn't a feature I'm very familiar with; but is not related to the initial semi-colon error. (Also, a semi-colon isn't strictly needed to end a SQL statement, but that's a detail for another time...).

这篇关于创建空间网络时出现SQL语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 08:42