Site Meter Technology How Tos: 2008

Tuesday, November 4, 2008

How to use commit in a Trigger

Say you have a procedure which inserts/updates records.

And you want to do this after a row is updated in a table in oracle.

Now you create a trigger and call this procedure. But it fails because Oracle throws an error saying "Commit - not allowed in a trigger".

The solution for this is to use the following :

create or replace myprocedure is

pragma AUTONOMOUS_TRANSACTION;

begin

...

do stuff

...

end;

And that should take care of it.

Technorati Tags: , , ,

Thursday, May 15, 2008

How to set the timeout variable in AIX

Our working environment has changed from Linux to AIX.
One of the things we noticed was that the session timeout was at a very low threshold. You leave your desk for 5 mins and your session is gone. Talked to the SA and the line is that its a compliance thing.

So what is the work around ?

set up the TMOUT environment variable. A value of 0 is unlimited.

System-wide, it could be added to /etc/profile; otherwise add it tousers $HOME/.profile

export TMOUT=3600
would terminate session if inactive for 1 hour