Ключевое слово from не найдено там где оно ожидалось
Перейти к содержимому

Ключевое слово from не найдено там где оно ожидалось

  • автор:

Ключевое слово from не найдено там где оно ожидалось

oracle tutorial webinars

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.

  1. The FROM keyword should follow the last selected item. Make sure it is not misspelled, misplaced, or missing.
  2. Make sure you have enclosed the alias in double quotation marks.
  3. 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.

Почему я получаю эту ошибку: «ORA-00923: ключевое слово FROM не найдено там, где ожидалось»

Таким образом, у меня есть эта таблица, каждая колонна ‘A, B, C’ представляющая сторона треугольника соответственно.

Я хочу проверить, соответствует ли значение A = B, и если да, отобразить на экране «Равнобедренный».

Я не могу за жизнь меня неимую снимать эту проблему. Вот мой простой запрос:

Похоже, синтаксис в порядке, а псевдоним заключен в одинарные кавычки. Может ли кто-нибудь взглянуть и сказать мне, что случилось?

3 ответа

Похоже, синтаксис в порядке, а псевдоним заключен в одинарные кавычки. Может ли кто-нибудь взглянуть и сказать мне, что случилось?

Одиночные кавычки — это как раз то, что не так. Когда вы задаете псевдоним для чего-либо, вам нужно использовать те же правила, которые вы используете при именовании объектов и столбцов, без кавычек, чтобы Oracle рассматривал это как верхний регистр по умолчанию, или использовать двойные кавычки, чтобы вы могли решить сами. Всегда нужно тщательно продумывать все, что чувствительно к регистру, это требует больших усилий, и о нем часто забывают. Вы же не хотите тратить часы на чесание в затылке, говоря: «Это должно быть здесь».

Изменить — после пересмотра того, что вы действительно могли бы получить после: Кроме того, вы не можете просто присвоить каждому столбцу одно целое, это странно. Вы могли иметь в виду дополнительную строку вроде

Да не совсем; если я вас правильно понял, вы должны использовать CASE (строки 1–6 представляют собой образцы данных; они у вас уже есть, поэтому нужный вам запрос начинается со строки № 7):

From keyword not found where expected oracle ошибка

Identifiers need to be quoted with double quotes ( » ). Single quotes ( ‘ ) denote a character value (not a «name»).

Therefor you need to use:

More details in the manual:

  • Database Object Names and Qualifiers
  • Text literals

answered Sep 16, 2013 at 14:35

a_horse_with_no_name

Add comma after SELECT QUERY

In my case, I had this query

As you may see, I didn’t had the comma after the SELECT BANK_NAME line.

The correct query is:

answered Jun 23, 2020 at 20:21

Gabriel Arghire

Gabriel Arghire Gabriel Arghire

1,903 1 gold badge 19 silver badges 34 bronze badges

Check reserved words. This was my issue. For whatever reason using «size» as a column alias caused oracle to spit that exact error out and it had me scratching my head for a while.

answered Dec 12, 2020 at 2:04

You may try doing this:-

answered Sep 16, 2013 at 14:37

Rahul Tripathi

Rahul Tripathi Rahul Tripathi

167k 31 gold badges 277 silver badges 331 bronze badges

answered Sep 16, 2013 at 14:37

Srini V

Srini V Srini V

11k 14 gold badges 66 silver badges 89 bronze badges

Similar error will be their when you have invalid select columns like below.
try below SQL and see yourself.

answered Dec 10, 2022 at 12:59

Vaibs

2,008 22 silver badges 29 bronze badges

totn Oracle Error Messages

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:

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.

Additionally, the condition unq.last_name = » won’t do what you think it does. Oracle does not have an «empty string». A string with length zero ( » ) will be stored as NULL , so what you really want is probably:

ORA-00923

ORA-00923: ключевое слово FROM не было найдено, где оно ожидалось

Причина:

В операторах SELECT или REVOKE ключевое слово FROM скорее всего пропущено, неправильно размещено, или неправильно написано. Ключевое слово FROM должно сопровождаться последним элементом в SELECT операторе, или привилегией в REVOKE операторе.

Действие:

Вставьте ключевое слово FROM где это следует. Выбранный вами список сам по себе может быть ошибочным.

Any suggestions on what is wrong with my code?
Perhaps it’s not possible to use Left Joins?

I keep getting the error «FROM keyword not found where expected» when my Advanced Editor uses the following code:

ORA-00923: FROM keyword not found where expected

The ORA-00923: FROM keyword not found where expected error occurs when the FROM keyword is missing, misspelled, or misplaced in the Oracle SQL statement such as select or delete. The FROM keyword is used to identify the table name. If an error occurs when checking for the FROM keyword, the table name cannot be found. If the the FROM keyword is missing from the SQL query, misspelled, or misplaced in the select statement, Oracle parser will fail to detect the FROM keyword. If the FROM keyword is not found where it should be, an error message ORA-00923: FROM keyword not found where expected will be displayed.

The FROM keyword is used in the select statement to specify the table or view name. The select statement could not identify the table names if the FROM keyword was missing, misspelled, or misplaced. The issue is caused by the FROM keyword or the code written before the FROM keyword. The issue ORA-00923: FROM keyword not found where expected will be fixed if you rewrite the select query along with the FROM keyword.

When this ORA-00923 error occurs

The error will occur in the Oracle database if the FROM keyword is missing, misspelled, or misplaced in the select statement. The error will occur if there are any errors in the code written before the FROM keyword. If you examine the sql query in and around the FROM keyword, you may be able to rectify the error.

Root Cause

The FROM keyword will be used in the select statement to specify the table or view name from which the data will be retrieved. If the FROM keyword is missing, misplaced, or misspelled in the select statement, the table name cannot be identified. In this example, the select statement expects the presence of a FROM keyword in the query. As a result, an Oracle error “ORA-00923: FROM keyword not found where expected” will be thrown.

Solution 1

If the FROM keyword is not present in the select statement, it should be added before the table or view name. The select statement reads the table or view name and retrieves data from it. Check that the FROM keyword is present in the select query.

Problem
Solution

Solution 2

Oracle will give an error if the FROM keyword in the select statement is misspelled. The FROM keyword was not found in the query, thus the select statement failed. In this scenario, the table or view name could not be discovered. The FROM keyword must be properly written. The FROM keyword is case insensitive.

Problem
Solution

Solution 3

If the FROM keyword is misplaced in the select statement, an error notice will be produced. The FROM keyword should come before the table or view name and after the list of column names. If the FROM keyword is used in combination with the name of a column, Oracle will consider the FROM keyword to be one of the columns and will expect the FROM keyword to identify the table or view name.

Problem
Solution

Solution 4

If there is a mistake in the list of column names in the select statement, an error message will be displayed. Oracle will treat the error in the column list and expects the FROM keyword in the select statement to specify the table or view name. The column name contains a space in between and no double quotes is used to the column name.

Problem
Solution

Solution 5

The error will be thrown if the column name is identified with a single quotation. The column name should be included in double quotation marks. The issue may be fixed by changing the single quotation to a double quotation. In Oracle, a single quote will be used to identify the string value or date value. In the column names, a double quotation should be utilized.

Problem
Solution

Solution 6

The from keyword error happens in the Oracle database if any of the oracle keywords is used as the column names in the select statement. The keyword should not be used as the name of a column. The issue may be fixed by deleting the keyword from the column name.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *