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.
select id,name emp;
ORA-00923: FROM keyword not found where expected
00923. 00000 - "FROM keyword not found where expected"
*Cause:
*Action:
Error at Line: 9 Column: 18
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
select id,name emp;
ORA-00923: FROM keyword not found where expected
00923. 00000 - "FROM keyword not found where expected"
Solution
select id,name FROM emp;
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
select id,name FRM emp;
ORA-00923: FROM keyword not found where expected
00923. 00000 - "FROM keyword not found where expected"
Solution
select id,name FROM emp;
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
select id,name, FROM emp;
ORA-00923: FROM keyword not found where expected
00923. 00000 - "FROM keyword not found where expected"
Solution
select id,name FROM emp;
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
select id, name as senior manager from emp;
ORA-00923: FROM keyword not found where expected
00923. 00000 - "FROM keyword not found where expected"
Solution
select id, name as "senior manager" from emp;
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
select id, name as 'senior manager' from emp;
ORA-00923: FROM keyword not found where expected
00923. 00000 - "FROM keyword not found where expected"
Solution
select id, name as "senior manager" from emp;
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.
Problem
select id as size from emp;
ORA-00923: FROM keyword not found where expected
00923. 00000 - "FROM keyword not found where expected"
Solution
select id as size_ from emp;