Oracle Error QSM-01031: materialized view, string, is stale in TRUSTED integrity mode

Oracle Error Message

QSM-01031: materialized view, string, is stale in TRUSTED integrity mode

Reason for the Error

A stale materialized view cannot be used for query rewrite when the query rewrite integrity mode is set to TRUSTED.

Solution

Refresh the materialized view or alter the rewrite integrity mode with ALTER SESSION QUERY_REWRITE_INTEGRITY = STALE TOLERATED command.