ORA-00911: invalid character

Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
  • User AvatarANKUSH THAVALI
  • 11 Nov, 2021
  • 0 Comments
  • 1 Min Read

ORA-00911: invalid character

ORA-00911: invalid character

Cause: identifiers may not start with any ASCII character other than letters and numbers. $#_ are also allowed after the first character. Identifiers enclosed by doublequotes may contain any character other than a doublequote. Alternative quotes (q'#...#') cannot use spaces, tabs, or carriage returns as delimiters. For all other contexts, consult the SQL Language Reference Manual.

Action: None

ORA-00911 exception is very common and usually occurs for common syntax mistakes. ORA-00911 occurs usually when a programmer makes one of the following mistakes

1. when a special character is added in an SQL statement with column name

SQL> select ename# from scott.emp;
select ename# from scott.emp
       *
ERROR at line 1:
ORA-00904: "ENAME#": invalid identifier

2. when some non-printable/special character added because of paste of sql statement from other editer (usually Acute` instead of quote')

SQL> select * from scott.emp where ename like `A%`;
select * from scott.emp where ename like `A%`
                                         *
ERROR at line 1:
ORA-00911: invalid character

3. when string is not enclosed by single quotes in where clause condition

SQL> select * from emp where ename like A%;
select * from emp where ename like A%
                                    *
ERROR at line 1:
ORA-00911: invalid character

4. when a extra semicolon (;) is added to end the query

SQL> select empno from emp;;
select empno from emp;
                     *
ERROR at line 1:
ORA-00911: invalid character

5. when semicolon (;) is added to end the query in execute immediate of pl/sql

SQL> begin
  2     execute immediate 'update scott.emp set sal = sal * 1.1 where deptno=10;';
  3     commit;
  4  end;
  5  /
begin
*
ERROR at line 1:
ORA-00911: invalid character
ORA-06512: at line 2

6. when semicolon (;) is added to end the query executing from programming language like .net or java