Oracle's ORA-00904 Error

Source: Internet
Author: User
Tags empty valid
ORA-00904 Invalid column name

ORA-00904: Invalid column name

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, is less than or equal to characters, and consist of only alphanumeric cha Racters and the special characters $, _, and #. If It contains other characters, it must is enclosed in double quotation marks. It may isn't be a reserved word.

Reason: Column missing or invalid column name.

Scenario: Enter a valid column name. A valid column name must begin with a letter, less than 30 characters, and contain only letters, numbers, or some special symbol $,_,#. If another character is included, the character must be enclosed in double quotes. The column name cannot be a keyword.

Case one: Problems when creating a table

Problem Description:

sql> DESC S_customer;

is the name empty? Type

-----------------------------------------

ID not NULL number (7)

Name not NULL VARCHAR2 (50)

Phone VARCHAR2 (25)

Address VARCHAR2 (400)

City VARCHAR2 (30)

State VARCHAR2 (20)

Country VARCHAR2 (30)

Zip_Code VARCHAR2 (75)

Credit_rating VARCHAR2 (9)

SALES_REP_ID Number (7)

region_id Number (7)

Comments VARCHAR2 (255)

But when I select, I always make an error:

sql> SELECT ID from S_customer;

SELECT ID from S_customer

*

ERROR is on line 1th:

ORA-00904: "ID": Invalid identifier

How could that be?

Solution: When Oracle accesses the database link for SQL Server, the field name is enclosed in double quotes when using SELECT *. Did you add double quotes to the statement you created the table? It's probably a PD-like tool created by a script, right?

Look at the example below

sql> CREATE TABLE Test ("id" number not NULL);

Table has been created.

sql> select ID from test;

Select ID from Test

*

ERROR is on line 1th:

ORA-00904: "ID": Invalid identifier

sql> select ID from test;

Select ID from Test

*

ERROR is on line 1th:

ORA-00904: "ID": Invalid identifier

sql> desc test;

is the name empty? Type

----------------------------------------- -------- ------------

ID not NULL number

sql> Select "id" from test;

No rows selected

sql>

Case TWO:

Environment: Solaris+oracle

Problem: Exp Time encountered

Exp-00008:oracle Error 904 encountered

Ora-00904:invalid Column Name

Exp-00000:export terminated unsuccessfully

Provided: The WCS Group uses Java, so judgment is a Java problem. A bug in Oracle when ora-00904.

So you need to use Errorstack to track bugs. Perform

Alter system set events= ' 904 trace name Errorstack ';

Then look at the trace file under Udump. Discovery is the problem of exu8jbqu this view.

Alter system set events= ' 904 trace name errorstack off ';

To see if exu8jbqu exists:

Select Owner,object_name,object_type,object_id,status

From dba_objects where object_name= ' exu8jbqu ';

Found existence. Re-execute $oracle_home/rdbms/admin/catexp.sql to create the view.

Re-performing exp succeeded. Solve the problem.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.