17 June 2010

Last changed user and date in apex

I didn't know I could pass the APP_USER from APEX into a databasetrigger!
The nvl construction saves me from empty fields when updating on backend.


create or replace trigger TRG_BIU
before insert or update on TBL_DEMO
for each row
begin
:new.DB_LAST_CHANGED_DATE := sysdate();
:new.DB_LAST_CHANGED_BY := nvl(v('APP_USER'),USER);
end;