Get current program with sys_context('userenv','sessionid') and v$session : sys_context « SQL Plus « Oracle PL / SQL






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

    
SQL>
SQL>
SQL> set serveroutput on
SQL> declare
  2    myModule varchar2(48);
  3  begin
  4    select b.module into myModule from v$session b where b.audsid = sys_context('userenv','sessionid');
  5    dbms_output.put_line('Current Program is ' || myModule);
  6  end;
  7  /
Current Program is SQL*Plus

PL/SQL procedure successfully completed.

SQL>
SQL>

   
    
    
    
  








Related examples in the same category

1.sys_context(''userenv'',''sessionid'')
2.Use SYS_CONTEXT to retrieve the database name