views:

477

answers:

1

Hi,

Im trying to execute a refresh on a materialized view, but I cant get the script to compile.

CREATE OR REPLACE PROCEDURE REFRESH_MV AS
BEGIN
    exec DBMS_MVIEW.REFRESH('my_mat_view_mv','C');
END REFRESH_MV;

I get the message:

ORA-06550: line 3, column 9: PLS-00103: Encountered the symbol "DBMS_MVIEW" when expecting one of the following:

:= . ( @ % ; immediate The symbol ":=" was substituted for "DBMS_MVIEW" to continue.

Am i doing something wrong ? Need to import anything?

Update

CREATE OR REPLACE PROCEDURE REFRESH_MV AS
BEGIN
    EXECUTE  DBMS_MVIEW.REFRESH('my_mat_view_mv','C');
END REFRESH_MV;

(S1917) Expecting: ( ; @
IMMEDIATE

CREATE OR REPLACE PROCEDURE REFRESH_MV AS
BEGIN
    EXECUTE IMMEDIATE DBMS_MVIEW.REFRESH('my_mat_view_mv','C');
END REFRESH_MV;

Warning: compiled but with compilation errors

This is an Oracle 10g XE, hope thats no problem.

Thanks in advance !

+7  A: 

I think if you just eliminate the "exec" altogether it might work better. "exec" is a SQL*Plus command. IOW, try:

CREATE OR REPLACE PROCEDURE REFRESH_MV AS
BEGIN
    DBMS_MVIEW.REFRESH('my_mat_view_mv','C');
END REFRESH_MV;
DCookie
Yes, thats the way i fixed it.Thanks
Tom