Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: automatic update of a variable in pl/sql
Laura Martignas wrote:
> Hi,
>
> In PL/SQL, is it possible to declare a variable that will be updated each
> time a field of a table will have its value changed ?
>
> For example, the attribute %TYPE update the type of a variable each time
> the type of a field is changed. Is it possible to have the same thing not
> for the type of the field, but for its value ?
>
> Thanks
> Laura
Not in the variable's declaration but the result can be accomplished by a different mechanism.
First create a global variable by defining it in a package header and write a function in the package body that updates it.
Then write an AFTER INSERT OR UPDATE trigger on the table setting the variable when the trigger fires and no exception is raised.
If you do this test it carefully as there may be issues related to your implementation.
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace 'x' with 'u' to respond)Received on Wed Mar 23 2005 - 10:06:55 CST