Use SYS_CONTEXT to retrieve the database name : sys_context « SQL Plus « Oracle PL / SQL






Use SYS_CONTEXT to retrieve the database name

    

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>

   
    
    
    
  








Related examples in the same category

1.sys_context(''userenv'',''sessionid'')
2.Get current program with sys_context('userenv','sessionid') and v$session