Re: How to trigger which program updated a table ?

From: Jaakko <>
Date: Fri, 30 Oct 2009 18:12:31 +0200
Message-ID: <1gEGm.33823$>

Maija-Leena kirjoitti:
> Hi,
> I need to log some updates and I would like to do it using a trigger which
> inserts a line to a logtable. I need to know which application (sqlplus,
> java, toad etc) was used to make the update. I've studied sys_context but
> didn't find that information. Toad's Session Browser shows programs that are
> connected to the database, so I think it's possible. Do You know how ?
> Thanks !
> Maija-Leena

Hello Maija-Leena!

You can read the information from the V$SESSION view.

For example:

select u.program,u.machine,u.terminal
into p_program,p_machine,p_terminal
from v$session u
where u.audsid = userenv('sessionid') ;

This of course requires extended permission, but there is a work-around: put this query in a package which has the permission and call it from the trigger.

HTH,         Jaakko Received on Fri Oct 30 2009 - 11:12:31 CDT

Original text of this message