ORA-12015: cannot create a fast refresh materialized view from a complex query

http://inthirties.com:90/viewthread.jsp?tid=1380&frombbs=1

 

[oracle@solaris ~]oerr ora 12015
12015, 00000, “cannot create a fast refresh materialized view from a complex query”
// *Cause: Neither ROWIDs and nor primary key constraints are supported for
// complex queries.
// *Action: Reissue the command with the REFRESH FORCE or REFRESH COMPLETE
// option or create a simple materialized view.


在online redefinition里,start_redef_table的时候,提示上面的错误。online redef是基于materialized view的技术的,就如你看到的有的,有USE_PK和USE_ROWID一样,这些都是在我们在materialized view里经常看到的概念,这里一样,由于在transfer的过程中,无法准确应用mvlog从而导致专业的问题。

这里我这里出错的原因,就是在我加入了一个自己定义的function。

如下

SQL> exec dbms_redefinition.start_redef_table(’TEST’,'T’,'T_NEW’, ‘id, test.id2name(id) name’);
BEGIN dbms_redefinition.start_redef_table(’TEST’,'T’,'T_NEW’, ‘id, test.id2name(id) name’); END;

*
ERROR at line 1:
ORA-42008: error occurred while instantiating the redefinition
ORA-12015: cannot create a fast refresh materialized view from a complex query
ORA-06512: at “SYS.DBMS_REDEFINITION”, line 50
ORA-06512: at “SYS.DBMS_REDEFINITION”, line 1343
ORA-06512: at line 1

这里加了一个自己的function, id2name,
如下

create or replace function id2name(tid number) return varchar Deterministic is
rtnname varchar(4000);
begin
select object_name into rtnname from all_objects where object_id = tid;
return rtnname;
end;

这里在定义的地方加上Deterministic 即可。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

inthirties

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值