Forms: reusable pre-insert trigger

From: BAMAN MOTIVALA <bmotivala_at_swipnet.se>
Date: Wed, 23 Jun 1999 15:20:35 +0100
Message-ID: <yg5c3.194$iK3.53_at_nntpserver.swip.net>


Hello,

[Quoted] I need to insert and update the userid and the sysdate into audit columns every time a user creates or changes a record. All of the tables in the database have an audit_username and an audit_date column.

Right now I have a form with a block level PRE-INSERT that looks like this:

:block_1.audit_username := get_application_property(username);
:block_1.audit_date := sysdate;

If I create another block in the form I will have to write another block level PRE-INSERT that looks like this:

:block_2.audit_username := get_application_property(username);
:block_2.audit_date := sysdate;

Note that in both PRE-INSERT triggers the item names are identical. It is only the block names that are different.

  1. Can I create a form level PRE-INSERT trigger or perhaps a Program Unit that will work for both blocks?
  2. Can I somehow substitute the ':block_1' and ':block_2' with some kind of variable when assigning the values?
  3. Is there a better way to do this that I am missing?

Thanks,

Baman Received on Wed Jun 23 1999 - 16:20:35 CEST

Original text of this message