In an Oracle Database, what are the differences between the following:
CURRENT_SCHEMA
is the schema that will be assumed if you name an object without specifying its owner. For instance, if my CURRENT_SCHEMA
is SCOTT
, then SELECT * FROM EMP
is the same as SELECT * FROM SCOTT.EMP
. By default, when I first connect to Oracle, the CURRENT_SCHEMA
is the same as CURRENT_USER.
However, if I am connected as SCOTT
, I can issue ALTER SESSION SET CURRENT_SCHEMA=JOE
and then when I do SELECT * FROM EMP
, it is interpreted as JOE.EMP
rather than SCOTT.EMP
. Of course, if I don't have the SELECT
privilege on JOE.EMP
, or JOE
doesn't have an object named EMP
, the SELECT
will fail.