[英]ORA-00942: table or view does not exist on Materialized View refresh
I encounter an error whenever I refresh my Materialized view, so I created a PIPELINE function and left join it to my Main table, the creation of Materialized view runs smoothly, but when I tried to do a refresh, then the error message appeared.每当我刷新我的物化视图时都会遇到错误,所以我创建了一个 PIPELINE function 并将其加入我的主表,物化视图的创建运行顺利,但是当我尝试刷新时,出现了错误消息。
ORA-00942: table or view does not exist ORA-00942: 表或视图不存在
Please, need help on this.请,在这方面需要帮助。
create materialized view mv_test as
SELECT
id,
id1,
id2,
id3,
id4,
id5,
lpad(substr(ab.column_value, 3), 4, '0') ab
FROM
tbl1 t1 left join
TABLE ( split_str_by_delim(t1.id1, '|')) ab on substr(ab.column_value,1,2) =
'AB'
WHERE id2= sysdate;
Refresh:刷新:
begin
dbms_mview.refresh('MV_TEST','C');
end;
/
I also tried the snapshot refresh, and still doesn't work.我也尝试了快照刷新,但仍然无法正常工作。
BEGIN
DBMS_SNAPSHOT.REFRESH( '"MV_TEST"','C');
end;
Below is the error I encounter.以下是我遇到的错误。
Materialized view MV_TEST created.
Error starting at line : 22 in command -
begin
dbms_mview.refresh('MV_TEST','C');
end;
Error report -
ORA-00942: table or view does not exist
ORA-06512: at "SYS.DBMS_SNAPSHOT_KKXRCA", line 3020
ORA-06512: at "SYS.DBMS_SNAPSHOT_KKXRCA", line 2432
ORA-06512: at "SYS.DBMS_SNAPSHOT_KKXRCA", line 88
ORA-06512: at "SYS.DBMS_SNAPSHOT_KKXRCA", line 253
ORA-06512: at "SYS.DBMS_SNAPSHOT_KKXRCA", line 2413
ORA-06512: at "SYS.DBMS_SNAPSHOT_KKXRCA", line 2976
ORA-06512: at "SYS.DBMS_SNAPSHOT_KKXRCA", line 3263
ORA-06512: at "SYS.DBMS_SNAPSHOT_KKXRCA", line 3295
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 16
ORA-06512: at line 2
00942. 00000 - "table or view does not exist"
*Cause:
*Action:
Edit: Added my Function PIPELINE and TYPE编辑:添加了我的 Function 管道和类型
Type:类型:
create or replace TYPE split_tbl as TABLE OF VARCHAR2(32767);
Function: Function:
create or replace FUNCTION split_str_by_delim (p_list VARCHAR2, p_del
VARCHAR2)
RETURN split_tbl
PIPELINED IS
l_idx PLS_INTEGER;
l_list VARCHAR2 (32767) := p_list;
l_value VARCHAR2 (32767);
BEGIN
LOOP
l_idx := INSTR (l_list, p_del);
IF l_idx > 0 THEN
PIPE ROW (SUBSTR (l_list, 1, l_idx - 1));
l_list := SUBSTR (l_list, l_idx + LENGTH (p_del));
ELSE
PIPE ROW (l_list);
EXIT;
END IF;
END LOOP;
RETURN;
END split_str_by_delim;
regards, NelzKi问候, 内尔兹基
So, It works.所以,它有效。 I just added this additional join and it works like magic.我刚刚添加了这个额外的连接,它就像魔术一样工作。
left join dual on 1=1
materialized view refresh has been successful.物化视图刷新已成功。
Full Script:完整脚本:
create materialized view mv_test as
SELECT
id,
id1,
id2,
id3,
id4,
id5,
lpad(substr(ab.column_value, 3), 4, '0') ab
FROM
tbl1 t1 left join
TABLE ( split_str_by_delim(t1.id1, '|')) ab on substr(ab.column_value,1,2) = 'AB'
left join dual on 1=1
WHERE id2 = sysdate;
NelzKi内尔兹基
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.