ORA-00940: invalid identifier typically indicates that the SQL parser recognized a token as an identifier but the identifier referred to nothing.
For exampile, dual has no column named no_such_column, therefore, the following SQL statement throws this error:
select
dummy,
no_such_column
from
dual;
This error is often seen when a user thinks a function exists which in reality does not. For example, a developer coming from SQL Server might think Oracle has a function named isNull and hit such an error:
select
isnull(dummy, 'Y') dummy_
from
dual;
The error message ORA-00904: invalid identifier might also be caused in a create table statement if a column name was expected but none was given:
create table tq84_invalid_identifier (
id number(9) primary key,
val varchar2(10) , -- <== Note the comma
);
UNION ALL in combination with ORDER BY
Interestingly, an ORA-00904 is also thrown in the following statement (even though dual has a column named dummy):
Surprisingly (at least to me), an ORA-00904 error is also thrown if the second parameter of the standard_hash function is passed a value with lowercase letters.