Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

"alter view compile" What does it actually do?

GusoraAug 19 2016 — edited Aug 26 2016

An extract from the documentation:

Use the ALTER VIEW statement to explicitly recompile a view that is invalid

or to modify view constraints. Explicit recompilation lets you locate

recompilation errors before run time. You may want to recompile a view

explicitly after altering one of its base tables to ensure that the alteration

does not affect the view or other objects that depend on it.

I have created a view, altered the structure of the underlying table by removing a column and as expected when I selected from the view it threw up an error. If I run the compile command it reports back view has been altered. But if I repeat the select from the view the same error is thrown up again.

If I drop the underlying table and again run the compile command it again reports the view has been altered but if I select from the view it will as expected let me know there were errors.

So what is the point of the "alter view compile" command because it doesn't seem to be doing anything useful?

This post has been answered by BluShadow on Aug 19 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 23 2016
Added on Aug 19 2016
6 comments
12,894 views