Customise Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorised as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.

No cookies to display.

ORA-00904: invalid identifier

Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
ora
  • User AvatarKiran Dalvi
  • 10 Nov, 2021
  • 0 Comments
  • 1 Min Read

ORA-00904: invalid identifier

ORA-00904: invalid identifier

ORA-00904: invalid identifier

ora

Cause: The column name entered is either missing or invalid.

Action: Enter a valid column name. A valid column name must begin with a letter, be less than or equal to 30 characters, and consist of only alphanumeric characters and the special characters $, _, and #. If it contains other characters, then it must be enclosed in double quotation marks. It may not be a reserved word.

ORA-00904 is a very simple issue. ORA-00904 may occur when we try to create or alter a table with invalid column name. It also may occur when we try to reference a non existing column in a select / insert / update / delete statement.

Examples which may lead to ORA-00904 are following:

1
2
3
4
5
6
7
8
9
10
SQL> CREATE TABLE TEST
  2  (
  3     ID      NUMBER,
  4     NAME    VARCHAR2(200),
  5     COMMENT VARCHAR2(4000)
  6  );
        COMMENT VARCHAR2(4000)
        *
ERROR at line 5:
ORA-00904: invalid identifier
1
2
3
4
5
SQL> select empid from scott.emp;
select empid from scott.emp
       *
ERROR at line 1:
ORA-00904: "EMPID": invalid identifier
1
2
3
4
5
SQL> update scott.emp set salary=1000 where empno = 3625;
update scott.emp set salary=1000 where empno = 3625
                     *
ERROR at line 1:
ORA-00904: "SALARY": invalid identifier
1
2
3
4
5
SQL> delete scott.emp where empid = 3625;
delete scott.emp where empid = 3625
                       *
ERROR at line 1:
ORA-00904: "EMPID": invalid identifier
1
2
3
4
5
6
SQL> insert into scott.emp (empno, empname, sal)
  2  values(3625, 'Amit', 10000);
insert into scott.emp (empno, empname, sal)
                              *
ERROR at line 1:
ORA-00904: "EMPNAME": invalid identifier
1
2
3
4
5
SQL> select emp.ename from scott.emp e;
select emp.ename from scott.emp e
       *
ERROR at line 1:
ORA-00904: "EMP"."ENAME": invalid identifier

ORA-00904 can simply be avoided by using the valid column name in create or alter statement. Also for DML statements ORA-00904 can be avoided by making a valid reference to the column name or the alias.

A valid column name must follow following criteria

- The column name must begin with a letter.

- The column name can not be of more than 30 characters.

- The column name must be made up of alphanumeric characters

- The column name may contain following special characters: $, _, and #.

- If the column name uses any other characters, it must be enclosed in double quotation marks.

- The column name can not be a reserved word.