Get current user, session user and current schema by using sys_context : CONTEXT « SQL PLUS Session Environment « Oracle PL/SQL Tutorial






SQL> --
SQL>
SQL> create or replace procedure invoker_proc AUTHID CURRENT_USER as
  2  begin
  3      for x in ( select sys_context( 'userenv', 'current_user' ) current_user,
  4               sys_context( 'userenv', 'session_user' ) session_user,
  5               sys_context( 'userenv', 'current_schema' ) current_schema
  6          from dual )
  7      loop
  8          dbms_output.put_line( 'Current User:   ' || x.current_user );
  9          dbms_output.put_line( 'Session User:   ' || x.session_user );
 10          dbms_output.put_line( 'Current Schema: ' || x.current_schema );
 11      end loop;
 12  end;
 13  /

Procedure created.

SQL>








29.38.CONTEXT
29.38.1.SYS_CONTEXT ('WEB_CTX','WEBUSER')
29.38.2.Get current user, session user and current schema by using sys_context
29.38.3.Get and set client information by using: dbms_application_info.set_client_info and sys_context
29.38.4.use sys_context in where statement