Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Oracle/OAS and the fly likes Table or view does not exist , when it actually does exist Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "Table or view does not exist , when it actually does exist" Watch "Table or view does not exist , when it actually does exist" New topic
Author

Table or view does not exist , when it actually does exist

Mahtab Alam
Ranch Hand

Joined: Mar 28, 2012
Posts: 222

DBA_TAB_COLUMNS is the view that contains information about columns in tables,
and because of the DBA_ prefix, you know it contains information about tables and columns
that exist anywhere in the database, regardless of owner or privileges granted.


when I login to Oracle xe with user system and query the view dba_tab_columns it works.
But when I login to Oracle xe with a user abc that I have created and have given all privileges to abc , now I try to query dba_tab_columns it says "Table or view does not exist"

Can anybody tell whats the reason

Shukran


Oracle Java Programmer , Oracle SQL Expert
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3606
    
  60

Mahtab Alam wrote:and because of the DBA_ prefix, you know it contains information about tables and columns
that exist anywhere in the database, regardless of owner or privileges granted.

Right. And because of the DBA prefix you know that the table is supposed to be accessible to database administrators only too. Which is the default setting and really shouldn't be changed unless absolutely necessary. (Or unless you're just learning about it, of course.)

But when I login to Oracle xe with a user abc that I have created and have given all privileges to abc ,

There's a lot of privileges and roles. Show us what privileges exactly you have granted. I really doubt you've granted them all. Ideally show the grant statements themselves.

now I try to query dba_tab_columns it says "Table or view does not exist"

Can anybody tell whats the reason

The "Table or view does not exist" message is displayed when the table being queried doesn't exist, or when it does exist, but the current user doesn't have privileges to select from it, which is your case. This is for security reasons, so that some user cannot try to guess the names of existing tables and have their existence confirmed by error messages indicating lack of privileges over an existing table.

DBA_TAB_COLUMNS is actually a public synonym for a view in the SYS schema, so the privilege needs to be granted to the underlying table, not to the public synonym.

You might want to read about Data Dictionary views and something about privileges and roles.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Table or view does not exist , when it actually does exist
 
Similar Threads
ORA-00942 How to figure out privileges problem
DB2 700 and 701 - Test Sample
login details for SYSTEM account in oracle 11g
inserting a new column to an existing oracle table with a fixed value in all the rows of that column
SQL injection?