How to Fix ORA-00923: FROM Keyword Not Found Where Expected in Oracle

Find what ended the select list too early in ORA-00923: a missing comma, a reserved word as alias, or SELECT TOP.

ORA-00923 means Oracle read the select list of a query and did not find the FROM keyword where the list should end. Something in the select list made the parser think the list was over: usually a missing comma between columns, an alias that is a reserved word, or syntax from another database. The position in the error points to where Oracle expected FROM.

Reproduce the Error

Example:

select 1 as one 2 as two from dual;
select 'x' as select from dual;

Output:

Error starting at line : 1
In command -
select 1 as one 2 as two from dual
Error at Command Line : 1 Column : 17
Error report -
SQL Error: ORA-00923: FROM keyword not found where expected

Error starting at line : 2
In command -
select 'x' as select from dual
Error at Command Line : 2 Column : 15
Error report -
SQL Error: ORA-00923: FROM keyword not found where expected
  • In the first query, the comma between the two columns is missing, so Oracle reads 1 as one alias and stops at 2.
  • In the second, the alias select is a reserved word, so Oracle cannot use it as an alias.

Fix: Separate Columns and Quote Reserved Aliases

Example:

select 1 as one, 2 as two from dual;
select 'x' as "SELECT" from dual;

Output:

   ONE    TWO
______ ______
     1      2

SELECT
_________
x

Other Common Causes

  • Syntax from other databases in the select list, such as SELECT TOP 10 from SQL Server; in Oracle, use FETCH FIRST 10 ROWS ONLY after ORDER BY.

Things to Know

  • Choose aliases that are not reserved words; V$RESERVED_WORDS lists them.
  • A reserved word can be an alias only in double quotes, and is then case-sensitive.

Related Guides

Conclusion

ORA-00923 means the select list did not end where Oracle expected FROM. Check the reported position for a missing comma, a reserved word used as an alias, or syntax from another database.

Vinish Kapoor
Vinish Kapoor

An Oracle ACE, author of four books on Oracle APEX, SQL and PL/SQL, and Oracle Forms, and a software developer building Oracle database applications since 2001.

guest

0 Comments
Oldest
Newest Most Voted