Solved

Oracle 11g: sqlplus: though tables queried do exist, I get a 'table does not exist' when running query, why?

Posted on 2013-01-04
6
879 Views
Last Modified: 2013-01-04
Hello Experts,

Oracle 11g: via sqlplus: connected to db successfully.

I run: SELECT table_name FROM all_tables;
I get all tables available....

However, when I try to simple query such:
SELECT * FROM tableName;
I get: table does not exist

is this a permission issue?
Is there a way via the command line to know what permissions I have?

Regards,
0
Comment
Question by:epifanio67
  • 3
  • 2
6 Comments
 
LVL 31

Assisted Solution

by:awking00
awking00 earned 250 total points
ID: 38744174
If you are in schema "A" and select table_name from all_tables, you will get the table_names in other schemas to which you have been granted access. So, for example, your first query returned a table_name of tab1, but it belonged to schema "B", when you select * from tab1 you will get the table or view does not exist message. However, you should be able to get results by qualifying the table_name with the schema - select * from B.tab1.
0
 
LVL 22

Accepted Solution

by:
Steve Wales earned 250 total points
ID: 38744183
Selecting from all_tables will show you all tables that the user you are connected to has access to see - not necessarily all the tables that user owns.

Try this instead:

select owner, table_name from all_tables;

Is the table you are trying to select from owned by another user ?

Taking the output from that query, you can then do:

select * from owner.tableName;

Try that, let us know if that resolves the issue.
0
 
LVL 31

Expert Comment

by:awking00
ID: 38744331
Isn't that kind of what I said?
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 22

Expert Comment

by:Steve Wales
ID: 38744351
Look at the timestamps of the replies.  Less than 2 minutes between them.

I was typing mine while you were typing yours and you finished first.  When I started typing my answer there was no other reply there.
0
 

Author Closing Comment

by:epifanio67
ID: 38744358
thank you experts... I really appreciate your help
0
 
LVL 31

Expert Comment

by:awking00
ID: 38744676
And usually I'm the slow typist :-) No harm meant.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now