Home > Ask the Oracle Database / Applications Experts > Oracle database design and architecture Questions & Answers > SQL execution error ORA-00904
Ask The Oracle Expert: Questions & Answers
EMAIL THIS

SQL execution error ORA-00904

Brian Peasland EXPERT RESPONSE FROM: Brian Peasland

Pose a Question
Other Oracle Categories
Meet all Oracle Experts
Become an Expert for this site


Oracle tips, scripts, and expert advice
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


>
QUESTION POSED ON: 28 November 2005
I'm receiving the SQL execution error "ORA-00904: invalid column name." I have checked all the names and they are correct. I checked the SQL string and it is working in TOAD, which means it retrieved the data. I am lost!


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google



RELATED CONTENT
Oracle database design and architecture
Why am I receiving Oracle memory allocation errors?
How to join two tables with unique keys in Oracle
How does the Oracle LGWR write to online redo log files?
Can I check an Oracle instance without logging into the Oracle server?
How to use V$SEGMENT_STATISTICS to find the most accessed Oracle table
Can I install an Oracle client on Windows 7?
How to use the Oracle Database Upgrade Assistant (DBUA)
Can I specify Oracle column order in my database table?
Can I have a single Oracle 11g RAC instance across multiple databases?
How to use the Oracle export utility to duplicate database structure

Oracle database design and architecture
Why am I receiving Oracle memory allocation errors?
How to join two tables with unique keys in Oracle
Can I check an Oracle instance without logging into the Oracle server?
How does the Oracle LGWR write to online redo log files?
How to determine your SQL database through needs analysis
Breaking down the contenders in the SQL database market
The MySQL open source database in the enterprise
Diving deeper into the SQL database features
What managers should consider when starting a database scaling project
How to use V$SEGMENT_STATISTICS to find the most accessed Oracle table

Oracle error messages
Why am I receiving Oracle memory allocation errors?
Oracle tutorial library: SearchOracle.com's learning guides
Oracle error 6550 may mean incorrect Oracle export version
Why does the archive log in Oracle give me the ORA-16032 error?
Are we getting the ORA-00382 error because we're at maximum block size?
How do I solve the ORA-00257 error in Oracle?
Solving common Oracle errors guide
Error during RMAN backup
ORA-12560 error with Oracle 10g Instant Client
Unable to view Oracle tables in NetBeans

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
E. F. Codd  (SearchOracle.com)
extent  (SearchOracle.com)
flexfield  (SearchOracle.com)
foreign key  (SearchOracle.com)
multidimensional database  (SearchOracle.com)
object-oriented database management system  (SearchOracle.com)
quad tree  (SearchOracle.com)
relational online analytical processing  (SearchOracle.com)
row  (SearchOracle.com)
splay tree  (SearchOracle.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


One thing that trips people up is the case sensitivity of Oracle table and column names. For most situations, you can specify table and column names without paying attention to the case sensitivity. But if the table was created with double quotes around the table or column name, then the table or column name must be specified with case sensitivity in mind. For example, assume I create the table as follows:

CREATE TABLE t1 (
  "Id"  NUMBER,
  "Val" VARCHAR2(10));
Since I put the column names in double quotes, I must match case when referring to these columns. The following query will fail with the ORA-904 error you mentioned above:
SELECT Id FROM t1;
The problem here is that Oracle first converts the column name to upper case wich does not match the name I specified in the CREATE TABLE statement. To get around this problem, I must put the column name in double quotes:
SELECT "Id" FROM t1;
Let's look at another example. I create a table as follows:
CREATE TABLE t2 (
   id NUMBER);
Now if I query this table as follows, I will receive the ORA-904 error:
SELECT "id" FROM t2;
In this example, the table was created without double quotes around the column name. When I put double quotes in my query, I am instructing Oracle to look for a column with that exact spelling. But Oracle converted the column name to upper case when the table was created, so the column is not found.




Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice



Oracle White Papers: Fusion Middleware
HomeNewsTopicsTipsAsk the ExpertsMultimediaWhite PapersProductsBlogs
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2003 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts