SQL命令未正确结束或标识符无效

时间:2013-03-25 20:31:06

标签: sql oracle

无法确定此查询导致异常的原因。任何帮助表示赞赏。

ORA-00933:SQL命令未正确结束

SELECT COUNT(sd.URI) AS OrchCount FROM SDETAIL AS sd, ORCH_ASSOC AS orch WHERE sd.uri=orch.OPERATION_ AND sd.LEVEL='OrchA'

SELECT COUNT(SDETAIL.URI) AS OrchCount FROM SDETAIL WHERE SDETAIL.URI=ORCH_ASSOC.OPERATION_ AND SDETAIL.COMPONENTLEVEL='OrchA'

ORA-00904:“ORCH_ASSOC”。“OPERATION_”:标识符无效

2 个答案:

答案 0 :(得分:0)

AS关键字仅用于分配列别名,而不是表:

FROM SDETAIL AS sd, ORCH_ASSOC AS orch

你可以省略AS,它应该可以正常工作:

FROM SDETAIL sd, ORCH_ASSOC orch

答案 1 :(得分:0)

@clav对ORA-00904是正确的。至于ORA-00933,那是因为你这样做了:

... FROM SDETAIL AS sd

改为执行此操作(不是“as”):

... FROM SDETAIL sd