dbTalk Databases Forums  

Materialized View

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss Materialized View in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
The Magnet
 
Posts: n/a

Default Materialized View - 04-14-2011 , 09:27 AM






Hey, thanks to those who helped me with that convoluted query before.
Here is another weird thing. I need to create a Materialized View
based on a virtual table in my PL/SQL code. So, I define the type and
define the record and assign values to it like this:

CREATE OR REPLACE
TYPE MF_RECORD_TYPE AS OBJECT
..
..
CREATE OR REPLACE
TYPE MF_TABLE_TYPE IS TABLE OF mf_record_type;
..
..
v_mf_record mf_table_type := mf_table_type();
..
..
v_mf_record(x) := mf_record_type(data,........


But the actual materialized view statement fails:


EXECUTE IMMEDIATE ('CREATE MATERIALIZED VIEW mf_snapshot_mv AS
SELECT * FROM TABLE (CAST (v_mf_record AS mf_table_type))');

ORA-00904: "V_MF_RECORD": invalid identifier

Can I not do this to create a materialized view? In case it matters,
we are on 10gR2.

Reply With Quote
  #2  
Old   
Mark D Powell
 
Posts: n/a

Default Re: Materialized View - 04-15-2011 , 11:43 AM






On Apr 14, 10:27*am, The Magnet <a... (AT) unsu (DOT) com> wrote:
Quote:
Hey, thanks to those who helped me with that convoluted query before.
Here is another weird thing. *I need to create a Materialized View
based on a virtual table in my PL/SQL code. *So, I define the type and
define the record and assign values to it like this:

CREATE OR REPLACE
TYPE MF_RECORD_TYPE AS OBJECT
.
.
CREATE OR REPLACE
TYPE MF_TABLE_TYPE IS TABLE OF mf_record_type;
.
.
v_mf_record * * mf_table_type := mf_table_type();
.
.
v_mf_record(x) := mf_record_type(data,........

But the actual materialized view statement fails:

* EXECUTE IMMEDIATE ('CREATE MATERIALIZED VIEW mf_snapshot_mv AS
* * SELECT * FROM TABLE (CAST (v_mf_record AS mf_table_type))');

ORA-00904: "V_MF_RECORD": invalid identifier

Can I not do this to create a materialized view? *In case it matters,
we are on 10gR2.
It looks like you are trying to create an object type materialized
view which would require use of the OF OBJECT_TYPE clause.

See >> OF object_type

The OF object_type clause lets you explicitly create an object
materialized view of type object_type.
<<

at http://download.oracle.com/docs/cd/B...htm#SQLRF01302

HTH -- Mark D Powell --

Reply With Quote
  #3  
Old   
The Magnet
 
Posts: n/a

Default Re: Materialized View - 04-18-2011 , 11:11 AM



On Apr 15, 11:43*am, Mark D Powell <Mark.Powe... (AT) hp (DOT) com> wrote:
Quote:
On Apr 14, 10:27*am, The Magnet <a... (AT) unsu (DOT) com> wrote:









Hey, thanks to those who helped me with that convoluted query before.
Here is another weird thing. *I need to create a Materialized View
based on a virtual table in my PL/SQL code. *So, I define the type and
define the record and assign values to it like this:

CREATE OR REPLACE
TYPE MF_RECORD_TYPE AS OBJECT
.
.
CREATE OR REPLACE
TYPE MF_TABLE_TYPE IS TABLE OF mf_record_type;
.
.
v_mf_record * * mf_table_type := mf_table_type();
.
.
v_mf_record(x) := mf_record_type(data,........

But the actual materialized view statement fails:

* EXECUTE IMMEDIATE ('CREATE MATERIALIZED VIEW mf_snapshot_mv AS
* * SELECT * FROM TABLE (CAST (v_mf_record AS mf_table_type))');

ORA-00904: "V_MF_RECORD": invalid identifier

Can I not do this to create a materialized view? *In case it matters,
we are on 10gR2.

It looks like you are trying to create an object type materialized
view which would require use of the OF OBJECT_TYPE clause.

See >> OF object_type

The OF object_type clause lets you explicitly create an object
materialized view of type object_type.


athttp://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statem....

HTH -- Mark D Powell --
Hi Mark,

Saw the previously and tried it with no luck. So, I'm still
researching on what it may be. Bottom line is that I should be able
to create a materialized from anything I want. Source of the data
should not matter, since a materialized view is the product.........

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.