Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: View getting invalidated

Re: View getting invalidated

From: Thomas Kyte <tkyte_at_oracle.com>
Date: 23 Apr 2002 11:05:17 -0700
Message-ID: <aa47ot02gok@drn.newsguy.com>


In article <aa3rgr$t4s$1_at_news.vsnl.net.in>, "Yash says...
>
>Hi,
>I have 2 tables A and B. The schema of both is identical. A view V is
>defined as ( select * from A union all select * from B).
>If I drop a particular column from both A and B, the view V is left
>invalidated. The Oracle documentation also says so. Any view that depends on
>a table that has been altered, remains invalidated till it is recompiled.
>
>So I did a : alter view V compile.
>This command succeeded.But the view did not get validated.
>
>Can anyone guess why this happens? One would expect the query to be
>reevaluated after recompilation. Since there is a select *, it should work
>fine. But it doesn't. Can someone suggest something?
>
>Thanks
>Yash
>
>

problem is a view like:

select * from t;

is expanded into

select "C1", "C2", "C3", ... from t;

when you recompile it, after dropping C3, it won't work.

select * is a dangerous thing to use, in code, in triggers.

--
Thomas Kyte (tkyte@oracle.com)             http://asktom.oracle.com/ 
Expert one on one Oracle, programming techniques and solutions for Oracle.
http://www.amazon.com/exec/obidos/ASIN/1861004826/  
Opinions are mine and do not necessarily reflect those of Oracle Corp 
Received on Tue Apr 23 2002 - 13:05:17 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US