Re: Triggers/SPL Time Stamping
Posted in 1995
You can do it. You need to do is write a stored procedure which will
retrun current datetime.
create procedure get_datetime()retruning date ..
return current
end procedure;
You trigger will then look something like this
create trigger xxxxxx for update of { here list al column names exceptthe coulmn which will cantain the datetime }
on your_table
for each row execute get_timestemp() into your_table.timestamp_column;
Regards, Rafal Czerniawski
DATASPACE CONSULTING PTY LTD
"John S. DeHart" <ht6@ornl.gov> wrote:
>Does anyone know how to automatically update audit fields within the same
>table utilizing a Trigger or SPL ?? For the following table:
> create table test
> (
> important_data char(60) not null,
> up_date_time datetime year to fraction(3)
> default current year to fraction(3),
> up_user_id char(12)
> default user);
> The default will work for the initial insert but will not handle the
>updates. Is it possible to create a SIMPLE Trigger/SPL to handle
>automatically updating up_date_time and up_user_id whenever a record is
>updated ?? We are currently utilizing ONLINE version 5.
>Thanks
>JSD
>==========================================================================
>John S. DeHart
>Wye Technologies
>Oak Ridge TN
>(615) 483-5621
>ht6@ornl.gov