I have 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 created successfully.But when I am trying to fetch the values by simple query like
select fname, lname
from reg1
where uname="bbb";
I am getting error like
ORA-00904: "bbb": invalid identifier
I cannot understand what I have done wrong here.
Invalid identifier means the column name entered is either missing or invalid, this is one of the most common causes of this error but not the only one. Sometimes it comes if you use names, which happened to be reserved word in Oracle database.
The ORA-00936 message is a missing expression error in Oracle. All that 'missing expression' means is that When attempting to operate a query, a particular part of the clause necessary for it to function was omitted in the text. Stated simply, you left out an important chunk of what you were trying to run.
By default, Oracle will upcase any identifiers. So if you need either lower case characters or special characters, or the identifier is an Oracle reserved word, it needs to be enclosed in double quotes. Since double quotes preserves case, the identifier also needs to be the correct case.
ORA-00979 “ Not a GROUP BY expression ” is an error issued by the Oracle database when the SELECT statement contains a column that is neither listed in GROUP BY nor aggregated. This error message can be confusing to beginners.
Use single quotes.
select fname,lname from reg1 where uname='bbb';
Oracle uses double quotes "
in order to identify cased object names. For instance the table "test"
is not the same as the table test
.
Strings should be enclosed by single quotes, '
.
Making your query:
select fname, lname from reg1 where uname = 'bbb';
What's actually happening in your query is Oracle is trying to find the column "bbb"
in the table reg1
, as this column doesn't exist you get the error thrown.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With