oracle ORA-00923 未在预期位置找到 FROM 关键字

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1439011/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 19:01:27  来源:igfitidea点击:

ORA-00923 FROM keyword not found where expected

sqloracleplsqlora-00923

提问by Theresa

I am trying to concatenate some fields to return a single string for each row from an oracle table. This is in 10g. Here is my query:

我试图连接一些字段以从 oracle 表中为每一行返回一个字符串。这是10g。这是我的查询:

SELECT t.value || '|' || t.label || '|' t.label_abbrv || '||' "mylist" 
  FROM list_value t
 WHERE t.value BETWEEN 195001 AND 195300;

I'm getting the "FROM keyword not found where expected" error. This is really annoying. It's a simple query. I'm sure it's something simple I'm missing.

我收到“未在预期位置找到 FROM 关键字”错误。这真的很烦人。这是一个简单的查询。我确定这是我遗漏的一些简单的东西。

回答by Theresa

D'oh! I found the problem. I'm missing a concat!

哦!我发现了问题。我缺少一个连接!

SELECT value || '|' || label || '|' ****||**** label_abbrv || '||' "mylist"
from list_value where (value between 195001 and 195300);

回答by ericp

If you used SQLPLUS client, it would have saved you a little time:

如果您使用 SQLPLUS 客户端,它会为您节省一点时间:

SQL> SELECT value || '|' || label || '|' label_abbrv || '||' "mylist"
  2  from list_value where (value between 195001 and 195300);
SELECT value || '|' || label || '|' label_abbrv || '||' "mylist"
                                                *
ERROR at line 1:
ORA-00923: FROM keyword not found where expected

You can break up your query to multiple lines to isolate the problem:

您可以将查询分解为多行以隔离问题:

SQL> edit
Wrote file afiedt.buf

  1  SELECT value || '|'
  2  || label ||
  3  '|' label_abbrv ||
  4  '||' "mylist"
  5  from list_value
  6  where
  7* (value between 195001 and 195300)
SQL> /
'|' label_abbrv ||
                *
ERROR at line 3:
ORA-00923: FROM keyword not found where expected

You might find SQLPLUS to be "primitive," but, hmmm, that's good for another question. Let me see if anyone else has asked about it yet.

您可能会发现 SQLPLUS 是“原始的”,但是,嗯,这对另一个问题很好。让我看看是否还有其他人问过它。

回答by Tony Andrews

I think your answer to your own question is still wrong - it should be:

我认为您对自己问题的回答仍然是错误的 - 应该是:

SELECT value || '|' || label || '|' || label_abbrv || '||' "mylist" 
                                   ^^^^