Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does SQL Developer think there's an error in my materialized views?

I created some materialized views and Oracle SQL Developer puts a little red 'x' next to each of them. At the moment they are returning the correct information when I query them and running the following query in SQL Plus suggests that there are no errors:

SELECT * FROM USER_SNAPSHOTS

The ERROR column in this returns 0 for the materialized views in question.

Does anyone know why SQL Developer thinks there is an error? Is there anywhere else I can check?

UPDATE

Taking Patrick's advice I ran the following query:

SELECT * FROM ALL_MVIEWS

The COMPILE_STATE is 'NEEDS_COMPILE' for each view in question. What does this mean? Why would it need to be recompiled? None of the underlying tables have been changed.

like image 606
user1578653 Avatar asked Sep 08 '14 14:09

user1578653


2 Answers

To fix 'red' cross icon on views (actually it is a white cross over red background) due to NEEDS_COMPILE run the ALTER VIEW COMMAND.

ALTER VIEW MY_VIEW COMPILE;

Check ORACLE SQL Reference about ALTER VIEW.

http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_4004.htm

like image 191
gabriel capparelli Avatar answered Oct 24 '22 08:10

gabriel capparelli


For some reason, simply refreshing the materialized views made the 'error' go away. So not a true error, more of a reminder that the data isn't up to date. I guess you can ignore it if the table structure hasn't actually changed then...

like image 22
user1578653 Avatar answered Oct 24 '22 09:10

user1578653