SQL> select first_name, month(hire_date) hire_month from employees where last_name = 'Chen' This pattern is rare though, we should talk about non-existent function calls. If you surprised that the column was missing from the table, it may be removed by someone else. We'd better to check the definition by describing the table. Insert into all_names_1 (first_name, last_name, num) values ('Ed', 'Chen', 100)Īs we know, the column NUM is a wrong column because it does not exist in the table. ORA-00904: "NUM": invalid identifier SQL> insert into all_names_1 (first_name, last_name, num) values ('Ed', 'Chen', 100) Select first_name, last_name, num from all_names_1 where first_name = 'Ed' SQL> select first_name, last_name, num from all_names_1 where first_name = 'Ed' The first case is to select a column which does not exist in the table. Using such normally created tables guarantees that it will no longer have ORA-00904 anymore? Let's see several common types of invalid identifiers. SQL> select first_name, last_name from all_names_1 where first_name = 'Ed' This is because SQL parser will treat all identifiers as upper-cased ones, then qualify each of every column. That is to say, column names in either lower or upper case is valid and acceptable. To avoid ORA-00904, you should query this table without any quotation marks. SQL> insert into all_names_1 select distinct first_name, last_name from employees Normally, we create a table without using double quotes: SQL> create table all_names_1 (First_Name varchar2(25), Last_Name varchar2(25)) In this section, ORA-00904 alerts users something is wrong, which may be caused by one of the following reasons:
0 Comments
Leave a Reply. |