Link to home
Start Free TrialLog in
Avatar of hraja77
hraja77

asked on

In Oracle sql how can write a query to show my current session details

Hi All,
In Oracle sql how can write a query to show the current session details, i.e. there are many people logged into the database but i want the pl/sql routine to just pickup the session details of the user currently executing the plsql;

please help

thanks
H
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

to find the session id:

declare
v_par1 NUMBER;
BEGIN
v_par1 :=SYS_CONTEXT('USERENV','SESSIONID');
dbms_output.put_line ('Session ID = '|| v_par1);
end;
/
Avatar of hraja77
hraja77

ASKER

thanks for the quick response angel;

i just need to know how do i get the machine info that the user is comming from ?
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can also use:

sys_context('USERENV', 'HOST')

to get the value of V$SESSION.MACHINE.

Due to security audit reasons, some places may not allow access to the V$SESSION view.