Re: global variables vs get statements
Date: Wed, 23 Jun 1999 13:52:18 +0100
Message-ID: <3770d634.0_at_145.227.194.253>
<snip>
>Which is more efficient:
>
>1) To create a PRE-FORM trigger with the following code:
>
>:global.username := get_application_property(username);
>:global.date := sysdate;
>
>And then reference these variables in PRE-INSERT and PRE-UPDATE triggers at
>the block
>level.
>
>Or.....
>
>2) Simply create PRE-INSERT and PRE-UPDATE triggers with the following
>code:
>
>:block.audit_username := get_application_property(username);
>:block.audit_date := sysdate;
>
>Does doing the GET_ statement and fetching the sysdate over and over again
>waste resources?
>
>Thanks,
>
>Baman
>
Its not really a question of resources.
If you really want, store the username in a hidden field (or global).
You shouldn't really do it for the date because the date has a time element
to it as well. By storing in a global which you allocate on entry into the
form, the same date and timestamp will be written to all records.
You may say 'i'm not bothered about the timestamp'. Trust me, when the time comes to interrogate the audit tables and you have loads of transactions on the same date, the only way to know the order which these transactions took place is by the timestamp.
To sum it up,use your second idea ;-)
Mark Received on Wed Jun 23 1999 - 14:52:18 CEST