I have a view and would like an index (key) on it, but we can't create an index on a view.
I was reading about materialized views where you create a table from an SQL statement and you can create an index on that.
So, can I create a (materialized view) table with a select of the data from a view, and then create an index on that materialized view?
Essentially, assuming I already have a view called myView which selects some data from various physical files, I would like to do the following:
But it doesn't seem to work... it doesn't seem to like the create table this way.
What am I missing? Would appreciate if someone could shed some light on this. Thanks.
I was reading about materialized views where you create a table from an SQL statement and you can create an index on that.
So, can I create a (materialized view) table with a select of the data from a view, and then create an index on that materialized view?
Essentially, assuming I already have a view called myView which selects some data from various physical files, I would like to do the following:
Code:
-- Create my materialized view CREATE TABLE MyMaterializedView AS SELECT myField1, MyField2, MyField3 FROM myView -- Create an index on my materialized view CREATE INDEX IDX_MYFIELD1 ON MyMaterializedView (myField1)
But it doesn't seem to work... it doesn't seem to like the create table this way.
What am I missing? Would appreciate if someone could shed some light on this. Thanks.
Comment