Home » SQL & PL/SQL » SQL & PL/SQL » materialized view on prebuilt table - refresh
materialized view on prebuilt table - refresh [message #628454] Tue, 25 November 2014 07:38 Go to next message
ecivgamer
Messages: 147
Registered: May 2011
Location: Ukraine
Senior Member
Hi all,

Please help me to learn how to work with materialized view on prebuilt table.


I created prebuilt table:

CREATE TABLE "RATER"."TMP003"
(
"ITEM_ID" NUMBER(10,0)
);




I created materialized view on prebuilt table:

CREATE MATERIALIZED VIEW "RATER"."TMP003" ("ITEM_ID")
ON PREBUILT TABLE
AS SELECT "COST_DETAIL_ITEMS"."ITEM_ID" "ITEM_ID" FROM "RATER"."COST_DETAIL_ITEMS"@EFLP2.EFLATBED.COM "COST_DETAIL_ITEMS";




I checked quantity of rows at original source object:

SELECT count(1) as cnt FROM "RATER"."COST_DETAIL_ITEMS"@EFLP2.EFLATBED.COM "COST_DETAIL_ITEMS";


cnt
-----
61047571



I checked quantity of rows at my result object:

select count(1) cnt from "RATER"."TMP003"


CNT
----------
0



I tried to refresh my result object:

exec DBMS_MVIEW.REFRESH('RATER.TMP003');


anonymous block completed



I checked quantity of rows at my result object after try to refresh:

select count(1) cnt from "RATER"."TMP003"


CNT
----------
0



Please help me to understand how to refresh my result object properly.

Thanks.

P.S.: Yes, I know that problem is between pc and chair Smile



Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
"CORE 11.2.0.4.0 Production"
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production
Re: materialized view on prebuilt table - refresh [message #628456 is a reply to message #628454] Tue, 25 November 2014 08:04 Go to previous messageGo to next message
John Watson
Messages: 8931
Registered: January 2010
Location: Global Village
Senior Member
The table you create needs to have the same columns and rows as the query for the view.
Re: materialized view on prebuilt table - refresh [message #628458 is a reply to message #628456] Tue, 25 November 2014 08:17 Go to previous messageGo to next message
ecivgamer
Messages: 147
Registered: May 2011
Location: Ukraine
Senior Member
Well, I created table with only one column

"ITEM_ID" NUMBER(10,0)

then I created view with the same column "ITEM_ID" and query retrieves only this one column "ITEM_ID".

Anything else?
Re: materialized view on prebuilt table - refresh [message #628462 is a reply to message #628458] Tue, 25 November 2014 08:37 Go to previous messageGo to next message
John Watson
Messages: 8931
Registered: January 2010
Location: Global Village
Senior Member
And what about the rows?
Re: materialized view on prebuilt table - refresh [message #628469 is a reply to message #628462] Tue, 25 November 2014 09:05 Go to previous message
ecivgamer
Messages: 147
Registered: May 2011
Location: Ukraine
Senior Member
John Watson,

I created table with only one column

"ITEM_ID" NUMBER(10,0)

then I created view with the same column "ITEM_ID" and query retrieves only this one column "ITEM_ID". 


I've done it from the very beginning.

Actually, Pravin Takpire from oracle.com community said "You will have to first populate the base pre-built table using create table as select from" and it works fine.

Thanks.
Previous Topic: execution time
Next Topic: Merge materialized views
Goto Forum:
  


Current Time: Thu Apr 25 09:15:12 CDT 2024