You may see the error
ORA-23401: materialized view OWNER.MVIEW does not existwhen you execute a procedure like:
beginor
dbms_mview.refresh('OWNER.MVIEW','C');
end;
begin
dbms_mview.refresh('MVIEW','C');
end;
Clearly there can be a variety of reasons, with the most trivial one being that you mistyped the materialized view name. Please note that if the object was created with a case sensitive name, you must take care of writing the name using the proper casing:
Suppose that you create a materialized view with a name like this:
create materialized view "Ugly_Name"If you execute:
refresh complete on demand
with rowid
as
select * from dual;
beginbacause you need to surround the name with double quotes:
dbms_mview.refresh('Ugly_Name','C');
end;
ORA-23401: materialized view "USER"."UGLY_NAME" does not exist
beginNote that if you are trying to do this on a materialized view residing in a different schema, you may get ORA-23401 if you omit entirely or use an improper letter casing for the schema name:
dbms_mview.refresh('"Ugly_Name"','C');
end;
beginor even if the user name is case sensitive and you mistype it...
dbms_mview.refresh('OTHER_USER."Ugly_Name"','C'); -- it should be "Other_User"
end;
beginBut, this is not enough, in order to succeed you must hold the ALTER ANY MATERIALIZED VIEW system privilege, otherwise you'll get ORA-01031 eventually.
dbms_mview.refresh('"Other_user"."Ugly_Name"','C'); -- it should be "Other_User"
end;
See message translations for ORA-23401 and search additional resources
2 comments:
hmm, a really useful posting about getting an error when you mistype the object name.
Another reason could by that you wrote YYY but the name is XXX.
Jan
Jan,
do you see any other reason(s) for getting this error?
If yes, could you please mention at least one?
Thanks,
Flavio
Post a Comment