我有一个查询,我每天必须做一次 此查询创建一个表,显示每天的特定总和数量 相反,我想在物化查询中这样做,以便不每天创建 这是查询:
create table close_qty
as
select item_code,item_conc_code,tran_bran_code,sum(tran_qty) bal_qty
from tranhist a,itemmast b
where a.tran_item_code = b.item_code
group by item_code,item_conc_code,tran_bran_code
我正在尝试创建物化视图,但我收到以下错误
ERROR at line 1:
ORA-00901: invalid CREATE command
这是我的查询
CREATE MATERIALIZED VIEW vwCloseQty
AS
select item_code,item_conc_code,tran_bran_code,sum(tran_qty) bal_qty
from tranhist a,itemmast b
where a.tran_item_code = b.item_code
group by item_code,item_conc_code,tran_bran_code
请告知是否会影响性能以及如何解决错误
答案 0 :(得分:1)
也许
CREATE MATERIALIZED VIEW vwCloseQty(item_code,item_conc_code,tran_bran_code, bal_qty)
as
select item_code,item_conc_code,tran_bran_code,sum(tran_qty)
from tranhist a,itemmast b
where a.tran_item_code = b.item_code
group by item_code,item_conc_code,tran_bran_code;
您仍然需要每天刷新一次 - 所以如果您每天只运行一次查询,那么物化视图就无法提供帮助。