Oracle Error ORA-30357: this PL/SQL function cannot be supported for query rewrite

Oracle Error Message

ORA-30357: this PL/SQL function cannot be supported for query rewrite

Reason for the Error

The statement referenced a PL/SQL function that is not marked DETERMINISTIC.

Solution

Perform one of the following actions:

– Remove the use of the PL/SQL function.

– Mark the PL/SQL function as DETERMINISTIC.

– Disable the REWRITE option on the materialized view. The function should be marked DETERMINISTIC only if it always returns the same result value for any given set of input argument values, regardless of any database state or session state. Do not mark the function as DETERMINISTIC if it has any meaningful side-effects.