Q

ORA-0942 error with embedded views

I am running into one of those ORA-0942 errors when I create a VIEW with embedded views. The SELECT by itself has no problems, but when I create a VIEW based on this SELECT, the view gets created, but when I do a SELECT on this view, I get ORA-0942.

I am running into one of those ORA-0942 errors when I create a VIEW with embedded views. The SELECT by itself has no problems, but when I create a VIEW based on this SELECT, the view gets created, but when I do a SELECT on this view, I get ORA-0942. We are on ORACLE 9i (Rel 9.2.0.4.0). Could it be a patch issue? We have had similar problems with Create Table As with embedded UNION ALL.

Would very much like to hear from you with a possible solution.

If the SELECT statement works just fine, but creating a view with this SELECT statement causes the ORA-00942 error, the most likely cause is that the user was granted SELECT privileges on a table (or view) through a role. Executing the SELECT statement will use the object privilege granted through the role. But the view requires the object privilege to be granted directly. Grant the privilege to the user directly and the CREATE VIEW will succeed.
This was first published in August 2006

Dig deeper on Oracle and SQL

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close