How does the user choose between Interpreted and Native compilation modes?

The compiler mode is determined by the session parameter plsql_compiler_flags. The user may set it thus�

alter session set plsql_compiler_flags = 'NATIVE' /* or 'INTERPRETED' */; 

�to set the compilation mode for subsequently compiled PL/ SQL library units. The mode is stored with the library unit's metadata, so that if it is implicitly recompiled as a consequence of dependency checking then the mode the user intended will be used. It may be inspected thus�

select o.object_name name, s.param_value comp_mode,
   from user_stored_settings s, user_objects o

   where
   o.object_id = s.object_id
   and param_name = 'plsql_compiler_flags'
   and o.object_type in ( 'PACKAGE', 'PROCEDURE', 'FUNCTION' );
   

Note however that Dbms_ Utility. Compile_ Schema uses the current value of
plsql_ compiler_ flags rather than the stored compilation mode.

Oracle recommends that all the PL/ SQL library units that are called from
a given top-level unit are compiled in the same mode. This is because there
is a cost for the context switch when a library unit compiled in one mode
invokes one compiled in the other mode. Significantly, this recommendation
includes the Oracle-supplied library units. (These are always shipped compiled
in interpreted mode.)