Почему я получаю сообщение «ORA-00923: ключевое слово FROM не найдено там, где ожидалось»?
Мне пришлось заменить двойные кавычки на одинарные в запросе, чтобы получить строку запроса для компиляции в среде IDE при переносе с Delphi на C#.
IOW с таким SQL, который работает в Delphi и Toad:
. Мне пришлось изменить его на это, чтобы он скомпилировался в Visual Studio:
Однако SQL не будет работать таким образом — я получаю сообщение об ошибке «ORA-00923: ключевое слово FROM не найдено там, где ожидалось» (как в Toad, так и при попытке выполнить SQL в приложении C#).
Как я могу заставить его скомпилировать и запустить?
B. Clay Shannon-B. Crow Raven
мы можем увидеть строку с размещением «от»? — KevinDTimm
Я могу избежать проблемы, удалив псевдонимы столбцов, которые в данном случае мне не нужны, но что, если я это сделаю/когда это сделает кто-то другой? — B. Clay Shannon-B. Crow Raven
@Кевин: . . . W.INTERLOPERTYPE, W.OFFICEDIVISION FROM RTINTERLOPERSTAT R, ABCWORKER W — B. Clay Shannon-B. Crow Raven
Что это @» префикс? Это точно недопустимый SQL. — a_horse_with_no_name
Нет, это для C#, чтобы я мог распределить строки SQL по нескольким строкам в редакторе, не работая над конкатенацией строк. IOW, то, что я только что написал (выше), вызовет ошибку компиляции, если я добавлю его к: String s = «, но если добавить его к String s = @», все будет в порядке. — B. Clay Shannon-B. Crow Raven
2 ответы
Кавычки вокруг псевдонимов вашей колонки вызывают изжогу.
Похоже, что в исходном случае весь запрос заключен в двойные кавычки, а двойные кавычки вокруг псевдонимов столбцов мешают им.
Во втором случае Oracle интерпретирует псевдонимы столбцов в одинарных кавычках как строки, что его искажает.
В Oracle вам тоже не нужно: вы должны иметь возможность просто кодировать:
или, используя необязательный AS ключевое слово:
Надеюсь это поможет.
ответ дан 19 апр.
Обычно это не работает, если у вас есть встроенные комментарии в запросе.
Не тот ответ, который вы ищете? Просмотрите другие вопросы с метками sql oracle ora-00923 or задайте свой вопрос.
Ключевое слово from не найдено там где оно ожидалось

ORA-00923 is a commonly seen error that is easily resolved by simply correcting its syntax. Keep in mind ORA-00923 does not occur in Oracle 10g.
The Problem
When you are faced with this error, you will see the following message:
ORA-00923 FROM keyword not found where expected
ORA-00923 occurs when you try to execute a SELECT or REVOKE statement without a FROM keyword in its correct form and place. If you are seeing this error, the keyword FROM is spelled incorrectly, misplaced, or altogether missing. In Oracle, the keyword FROM must follow the last selected item in a SELECT statement or in the case of a REVOKE statement, the privileges. If the FROM keyword is missing or otherwise incorrect, you will see ORA-00923.
The Solution
To resolve ORA-00923, the user should make sure three possible causes are corrected. First, the user must correct the syntax. Make sure you have placed the keyword FROM in its correct place, and that no spelling errors have occurred. Secondly, if you used quotation marks in an alias, make sure that they have properly enclosed the alias and that they are double quotation marks. Lastly, make sure no reserved words were used as an alias. See the Oracle appendix for reserved words to view a complete list. For practical application of these practices on how to resolve ORA-00923, see the following examples.
In the following example, the query is missing the keyword FROM:
To correct the statement, insert the FROM keyword in the correct place, and run again:
Another example of the ORA-00923 error is when quotation marks do not properly enclose the alias, as in the following:
SELECT manager AS manager column
The alias—in this example, manager column—is not enclosed in double quotation marks. Resolve ORA-00923 by fixing this syntax mistake.
SELECT manager AS “manager column”
Looking Forward
Avoiding ORA-00923 in the future is a matter of keeping to the proper syntax when executing SELECT or REVOKE statements. While correcting this error is not difficult, simply remember the following rules to avoid seeing this error.
- The FROM keyword should follow the last selected item. Make sure it is not misspelled, misplaced, or missing.
- Make sure you have enclosed the alias in double quotation marks.
- Make sure no Oracle reserved word was used as an alias.
If you continue to experience this error, you may consider contacting your database administrator or a licensed Oracle consultant. Always check your consultant’s credentials and experience to ensure they meet your needs.
FROM keyword not found where expected (Oracle) ORA-00923
![]()
You need an alias for both derived tables. And the outer pair around the from clause is useless.
But the join isn’t needed in the first place. Your query can be simplified to:
You don’t need to select first_name , last_name and postal_code in the inner select as you don’t use them in the outer select. This can make the query potentially more efficient.
Oracle / PLSQL: ORA-00923 Error Message
Learn the cause and how to resolve the ORA-00923 error message in Oracle.
Description
When you encounter an ORA-00923 error, the following error message will appear:
- ORA-00923: FROM keyword not found where expected
Cause
You tried to execute a SELECT statement, and you either missed or misplaced the FROM keyword.
Resolution
The option(s) to resolve this Oracle error are:
Option #1
This error can occur when executing a SELECT statement that is missing the FROM keyword.
For example, if you tried to execute the following SELECT statement:
You could correct this SELECT statement by including the FROM keyword as follows:
Option #2
This error can also occur if you use an alias, but do not include the alias in double quotation marks.
For example, if you tried to execute the following SQL statement:
You could correct this SELECT statement by using double quotation marks around the alias:
Option #3
This error can also occur if you add a calculated column to a SELECT * statement.
For example, if you tried to execute the following SQL statement:
You could correct this SELECT statement by including the table name qualifier in front of the wildcard:
Option #4
You can also generate this error by having an unbalanced set of parenthesis.
For example, if you tried to execute the following SQL statement:
You could correct this SELECT statement by removing the extra closing parenthesis just prior to the alias: