Now I queried the view User_objects and it shows the status of pgview as INVALID
then I inserted a row in the table pg and again queried the view User_objects now it shows the status as VALID.
My question is how status changes from INVALID to VALID .
My second quastion is
Suppose I rename a column or drop a column of a table , and that column was included in the view.
Now That view have no meaning ,Even If I try to recompile the view it will say "View altered with compilation errors"
I have to create the view a new altogether.
Now suppose rather than renaming or dropping the column I just change the datatype of the column ,and that column was included in the view.
Now Even If I don`t recompile the view it works ok.
So what I achieve from the statement " alter view view_name compile "
Oracle Java Programmer , Oracle SQL Expert , Oracle Java Web Component Developer, Oracle Web Service Developer
1) Invalid objects in Oracle are automatically recompiled when used. Consider
2) You'll use alter view view_name compile to compile it explicitly, without waiting for it to be used. Typical use would be in schema upgrade scripts, for example - you don't want to wait for the view to be used by an application or user to be compiled, you want to catch any possible problems early.
Edit: I'd suggest reading Oracle's Database Concepts Guide, lots of questions you've asked lately are well covered there.