Re: invalid views

  • From: "Thomas Day" <tomday2@xxxxxxxxx>
  • To: ORACLE-L <oracle-l@xxxxxxxxxxxxx>
  • Date: Fri, 22 Sep 2006 09:45:24 -0400

How is your developer fixing this problem?  I've had views go invalid in the
past, but if the base table(s) were unchanged, doing a select on the view
always changed its status to valid.



SQL> create table gorp (gorp1 number);

Table created.

SQL> insert into gorp values (5);

1 row created.

SQL> create view gorp5 as (select * from gorp where gorp1 = 5);

View created.

SQL> select * from gorp5;

    GORP1
----------
        5

1 row selected.

SQL> rename gorp to prog;

Table renamed.

SQL> select * from gorp5;
select * from gorp5
             *
ERROR at line 1:
ORA-04063: view "GORP5" has errors


SQL> select object_name , object_type, status from dba_objects where object_name = 'GORP5';

OBJECT_NAME
--------------------------------------------------------------------------------
OBJECT_TYPE        STATUS
------------------ -------
GORP5
VIEW               INVALID


1 row selected.

SQL> RENAME PROG TO GORP;

Table renamed.

SQL>  select object_name , object_type, status from dba_objects where
object_name = 'GORP5';

OBJECT_NAME
--------------------------------------------------------------------------------
OBJECT_TYPE        STATUS
------------------ -------
GORP5
VIEW               INVALID


1 row selected.

SQL>  select * from gorp5;

    GORP1
----------
        5

1 row selected.

Other related posts: