Search notes:

SQLPATH - who-am-i.sql

who-am-i.sql originally reported just the user that run this SQL script. Over time, the number of selected column increased and now also show database name, server name etc. so that the script probably should be named more accurately who-am-I-and-where-am-I-anyway.sql.
select
   substr   (user                                    , 1, 30) usr,
   substr   (sys_context('userenv', 'current_schema'), 1, 30) current_schema,
   to_number(sys_context('userenv', 'sid'           )       ) sid,
   substr   (sys_context('userenv', 'session_user'  ), 1, 30) session_user,
   substr   (sys_context('userenv', 'db_name'       ), 1, 30) db_name,
   substr   (            ora_database_name           , 1, 30) ora_database_name,
   substrb  (            global_name                 , 1, 30) global_name,
   substr   (sys_context('userenv', 'server_host'   ), 1, 30) server_host,
   substr   (sys_context('userenv', 'service_name'  ), 1, 30) service_name
from
   global_name;
Github repository Oracle-SQLPATH, path: /who-am-i.sql

See also

mysid.sql, mypid.sql
Oracle: files for ORACLE_PATH / SQLPATH

Index