Ask the Expert

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. 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.

    Requires Free Membership to View

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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

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: