Oracle® Database Administrator's Guide 11g Release 2 (11.2) Part Number E10595-04 |
|
|
View PDF |
The following statement sets the schema of the current session to the schema name specified in the statement.
ALTER SESSION SET CURRENT_SCHEMA = <schema name>
In subsequent SQL statements, Oracle Database uses this schema name as the schema qualifier when the qualifier is omitted. In addition, the database uses the temporary tablespace of the specified schema for sorts, joins, and storage of temporary database objects. The session retains its original privileges and does not acquire any extra privileges by the preceding ALTER
SESSION
statement.
In the following example, provide the password tiger
when prompted:
CONNECT scott ALTER SESSION SET CURRENT_SCHEMA = joe; SELECT * FROM emp;
Because emp
is not schema-qualified, the table name is resolved under schema joe
. But if scott
does not have select privilege on table joe
.emp
, then scott
cannot execute the SELECT
statement.