ORA-00905:缺少关键字错误oracle

时间:2015-06-08 17:15:11

标签: oracle

嗨,当我尝试执行以下oracle查询时,我正在

  

[错误] ORA-00905:缺少关键字

CREATE VIEW MJNSXJJRW_view AS  
SELECT B.oID AS "_oid", B.oTm AS "_otm" 
FROM 
(SELECT DISTINCT oID, oTm FROM MJNSXJJRW) B 
LEFT JOIN MJNSXJJRW AS S0 ON 
    B.oID = S0.oID AND 
    S0.idx = 0 AND 
    S0.kID = "str_val" ; 

1 个答案:

答案 0 :(得分:3)

最可能的问题是MJNSXJJRW AS S0。在定义列别名时使用AS关键字,而不是在定义表别名时使用。{/ p>

CREATE VIEW MJNSXJJRW_view AS  
SELECT B.oID AS "_oid", B.oTm AS "_otm" 
FROM 
(SELECT DISTINCT oID, oTm FROM MJNSXJJRW) B 
LEFT JOIN MJNSXJJRW S0 ON 
    B.oID = S0.oID AND 
    S0.idx = 0 AND 
    S0.kID = "str_val" ; 

我假设"str_val"是一列,而不是字符串文字。如果是后者,你应该使用单引号。