Use SYS_CONTEXT to retrieve the database name : SYS_CONTEXT « SQL PLUS Session Environment « Oracle PL/SQL Tutorial






SQL> SET TERMOUT OFF
SQL>
SQL> --Specify that new values for the database_name column
SQL> --go into a substitution variable called databasae_name
SQL> COLUMN database_name NEW_VALUE database_name
SQL>
SQL> --. 
SQL> SELECT SYS_CONTEXT('USERENV','DB_NAME') database_name
  2  FROM dual;

User System Privileges                                              Page    1

DATABASE_NAME
-----------------------------------------------------------------------------
XE

1 row selected.

SQL>








29.64.SYS_CONTEXT
29.64.1.Use SYS_CONTEXT to retrieve the database name
29.64.2.Get current program with sys_context('userenv','sessionid') and v$session
29.64.3.sys_context(''userenv'',''sessionid'')