create or replace TRIGGER REFRESH_REST_VIEW
AFTER
INSERT OR UPDATE
ON tbl_contract
BEGIN
execute DBMS_MVIEW.REFRESH('REST_VIEW');
END REFRESH_REST_VIEW;
commit;
This is my sql trigger i am using to refresh Materialized View. But it says..
Warning: execution completed with warning
TRIGGER REFRESH_REST_VIEW Compiled.
P.S. : The trigger will be executed when the data of table (used by Materialized View) takes any DML operation.
I have googled enough, many post says it is possible but I am not getting how to do it. I tried with regular trigger syntax and it doesn't works.
Updated:
Now i am trying to the same with Procedure and Trigger..
create or replace
PROCEDURE Rfresh_mate_views AS
BEGIN
DBMS_MVIEW.REFRESH('REST_VIEW');
END Rfresh_mate_views;
create or replace trigger refresh_company_mview
after insert or update ON BCD.BCD_COMPANY
begin
RFRESH_MATE_VIEWS();
end refresh_company_mview;
All has been compiled successfully but while updating in the table it says:
ORA-04092: cannot COMMIT in a trigger
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2449
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2429
ORA-06512: at "BCD.RFRESH_MATE_VIEWS", line 3
ORA-06512: at "BCD.REFRESH_COMPANY_MVIEW", line 2
ORA-04088: error during execution of trigger 'BCD.REFRESH_COMPANY_MVIEW'