Oracle Solution for Error ora-38815

Solution for Oracle Error ORA-38815

ORA-38815: ALTER SESSION SET EDITION must be a top-level SQL statement

What triggered the Error:

An edition switch failed because it was executed from a PL/SQL block or using recursive SQL.

What should we do to fix it:

Execute the statement from a top-level OCI call, or use dbms_session.set_edition if its deferred effect is appropriate.