ORA 00904 Error: Invalid identifier

I installed Oracle 10g in my virtual XP and created a table using

create table reg1 ( fname varchar2(30), lname varchar2(30), addr varchar2(30), mail varchar2(30), occu varchar2(30), uname varchar2(30), passwd varchar2(30) ); 

and the table is created successfully. But when I try to get the values ​​with a simple query like

 select fname, lname from reg1 where uname="bbb"; 

I get an error like

ORA-00904: "bbb": invalid identifier

I can’t understand what I did wrong here.

+6
source share
2 answers

Use single quotes.

 select fname,lname from reg1 where uname='bbb'; 
+17
source

Oracle uses double quotation marks to identify the casing names of objects. For example, the "test" table does not match the test table.

Strings must be enclosed in single quotes, ' .

Fulfilling your request:

 select fname, lname from reg1 where uname = 'bbb'; 

What actually happens in your query, Oracle is trying to find the "bbb" column in the reg1 table, since this column does not exist, you get an error.

+5
source

Source: https://habr.com/ru/post/919398/


All Articles