Oracle Error ORA-42803: Cannot use bind variable in VERSIONS clause when the object has a Row-Level Security (RLS) policy defined on it.

Oracle Error Message

ORA-42803: Cannot use bind variable in VERSIONS clause when the object has a Row-Level Security (RLS) policy defined on it.

Reason for the Error

The object being accessed had a Row-Level Security (RLS) policy defined on it and the VERSIONS clause contained a bind variable.

Solution

Rewrite the query without the bind variable in the VERSIONS clause.