Oracle PL/SQL Tutorial/SQL PLUS Session Environment/userenv

Материал из SQL эксперт
Перейти к: навигация, поиск

userenv("sessionid")

SQL>
SQL> -- ALTER SESSION SET SQL_TRACE = TRUE
SQL> -- SQL statement(s) to be traced ...
SQL> -- ALTER SESSION SET SQL_TRACE = FALSE
SQL>
SQL>
SQL> select a.spid
  2  from v$process a, v$session b
  3  where a.addr = b.paddr
  4  and b.audsid = userenv("sessionid")
  5  /
928
1 row selected.
SQL>


Use userenv

SQL>
SQL> exec dbms_application_info.set_client_info("KING");
PL/SQL procedure successfully completed.
SQL>
SQL> select userenv("CLIENT_INFO") from dual;
USERENV("CLIENT_INFO")
----------------------------------------------------------------
KING
SQL>