ACC: "ORA-00904: Invalid Column Name" Error Message in Query

Last reviewed: June 3, 1997
Article ID: Q108439
The information in this article applies to:
  • Microsoft Access versions 1.1, 2.0

SYMPTOMS

If you have a query based on an attached Oracle synonym that has a sort on a column name, and the owner of the synonym has read-only permissions on the table on which the synonym is based, you will receive the error messages:

   ODBC - call failed

   -and-

   [PageAhead][ODBC Oracle Driver][Oracle OCI]ORA-00904: invalid
   column name. [#904]

CAUSE

This error occurs because the owner of the synonym has read-only permissions on the Oracle table on which the synonym is based.

RESOLUTION

There are four ways to correct this problem:

  • Create a Public synonym in Oracle.
  • In Microsoft Access, attach directly to the table on which the synonym is based.
  • In Oracle, assign the owner of the synonym permissions greater than read-only.
  • In Microsoft Access, remove the "order by" clause from the query.

MORE INFORMATION

The following is an example of an SQL statement that will cause this error:

   SELECT * FROM <owner>.<synonym_name>
      ORDER BY <owner>.<synonym_name>.<column_name>

Note that the same errors will occur if this command is issued in SQL*DBA or SQL*PLUS, which are Oracle's interface tools. If you remove the ORDER BY clause, the statement will run. The statement will run with the ORDER BY clause if you remove the <owner>. clause instead. The statement will run with all the clauses included if you increase the owner's permissions on the table on which the query is based.

Steps to Reproduce Behavior

  1. In Oracle, create a table. Assign all permissions on the table to user A, and read-only permissions to user B.

  2. Log into Oracle as user A. Create synonym A based on the new table.

  3. Log into Oracle as user B. Create synonym B based on the new table.

  4. Start Microsoft Access. Attach synonym A with user A's login account. Create a query based on synonym A with a sort on one of the columns.

  5. Run the query. Note that the query runs correctly.

  6. Attach synonym B with user B's login account. Create a query based on synonym B with a sort on one of the columns.

  7. Run the query. The error messages stated above will occur.

NOTE: You can reproduce this behavior in Oracle's SQL*DBA as well. To do so, connect as user A and issue the following command:

  SELECT * FROM userA.synonymA ORDER BY userA.synonymA.column1;

Note that the command runs correctly. Next, connect as user B and issue the following command:

  SELECT * FROM userB.synonymB ORDER BY userB.synonymB.column1;

An error message will occur.


Additional query words: adk
Keywords : kberrmsg kbinterop OdbcOracl
Version : 1.1 2.0
Platform : WINDOWS
Hardware : X86
Issue type : kbprb
Resolution Type : Info_Provided


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 3, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.