If it’s a WHERE clause, I need to use the column name. If it’s an ORDER BY, I can use the column name or the alias. To correct it, I should refer to the alias correctly. There is no column or alias called st_id, so the query displayed an error. But, in the WHERE clause, I called it “st_id”. The error happened because I gave an alias to the student_id column, which is “stid”. The line numbers for errors can be helpful in working out the cause. This error occurred on line 3, according to the output. This query will return an ORA-00904 error: SELECT student_id AS stid, first_name, last_name Many IDEs will highlight the word if it is reserved. Check that the column name contains only alphanumeric characters, $, _, and #, or it is contained in double quotes.Check that the column name is 30 characters or less.Check that you’re not referring to a column alias inside a WHERE clause.if the department table is aliased as dept, then it should be partment_id and not sup.department_id) Check that you’re using the correct table alias for the column (e.g.Check that you’re referring to the correct alias when referring to the column.Check that your column name exists in the table you’re referring to.To resolve the ORA-00904 error, check the following: We can check this as part of the solution below. It could also mean you’re using quotes when they aren’t needed. It’s caused by referring to a column that does not exist, or you are referring to an invalid alias in a SELECT statement. So, you ran an SQL statement and you got this error: ORA-00904: invalid identifier Did you get an “ORA-00904: invalid identifier” error? Find out what caused the ORA-00904 error and how to resolve it in this article.
0 Comments
Leave a Reply. |