简体   繁体   English

缺少关键字ORA-00905

[英]Missing Keyword ORA-00905

please tell me what is the syntax problem in this query 请告诉我此查询中的语法问题是什么

SELECT sde
FROM TABLE_EW  sde , CASE_W  spr, DOCUMENT swp 
JOIN swp.id, swp.YEAR  ON (swp.id = sde.ID_DOCUMENT) 
JOIN spr.ID, spr.STATE, spr.NUMBER ON (spr.ID_DOCUMENT = swp.ID)  
WHERE sde.IDENT_TABLEEW LIKE '122337456464' 
AND swp.YEAR LIKE 2015;

SQLDeleoper point problem to From Line SQLDeleoper点问题到From Line

I think this is the query you meant to write: 我认为这是您要编写的查询:

SELECT sde.*,swp.id, swp.YEAR,spr.ID, spr.STATE
FROM TABLE_EW  sde 
JOIN DOCUMENT swp ON  (swp.id = sde.ID_DOCUMENT)
JOIN CASE_W spr ON (spr.ID_DOCUMENT = swp.ID)  
WHERE sde.IDENT_TABLEEW = '122337456464' 
AND swp.YEAR = 2015;

As mentioned in the comments, you have A LOT of errors in your SQL code. 如注释中所述,您的SQL代码中有很多错误。 You use implicit and explicit joins together, AVOID the use of implicit joins syntax and use only the proper syntax like my example. 您可以同时使用隐式和显式连接,请避免使用隐式连接语法,并且仅使用正确的语法,例如我的示例。

Also, only in the select you can specify the columns you want, I'm guessing what you've been trying to do is 另外,只有在选择中,您才能指定所需的列,我想您一直在尝试做的是

JOIN spr.ID, spr.STATE -> wanted this columns.

You should write them in the select part. 您应该将它们写在选择部分中。

Another problem is the join condition, you either use implicit joins, (from table,table2,table3..) and then the join condition is in the where clause or you use explicit joins and then the condition is in the ON clause. 另一个问题是联接条件,您可以使用隐式联接(来自table,table2,table3 ..),然后联接条件位于where子句中,或者使用显式联接,然后条件位于ON子句中。 You can't use both! 不能同时使用!

Another problem is the unnecessary use of LIKE . 另一个问题是不需要使用LIKE。 When comparing to an exact match, use EQUALS sign. 与完全匹配进行比较时,请使用EQUALS符号。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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