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 220.127.116.11.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
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.