Re: Triggers and Unix Time Format
Posted in 1994
From -Vaibhav Dahake:
*
* Is is possible to set update time (in Unix format time_t)
* in a trigger?
*
* We have an update trigger in our database which keeps two
* tables in sync for any updates and would like to keep
* track of the time when the trigger was run.
* The table has a column which keeps a record of the update
* time in unix format (a long number, yeah we gave up on using
* Informix datetime crazy formats and prefer good old Unix !!)
*
* An idealistic C/Trigger statement would look like:
*
* create trigger A
* update of col1A on tableA
* referencing new as newA
* for each row
* (update tableB
* set
* col2B = time(0) --How to do this ?
* where --col2B is long & time() is an Unix func
* col3B = newA.col4A --some condition
* );
The only way I see is to change col2B to a DATETIME YEAR TO FRACTION field,
( or whatever settings you want for a DATETIME field ) and try a trigger like:
create trigger A
update of col1A on tableA
referencing new as newA
for each row
( update tableB
set col2B = ( select current from systables where rowid = 1 )
where col3B = newA.col4A
);
Robert Minter |Data Systems Support| \\\\\\_///
Programmer, Software Development | Orange, CA | ( _ _ )
internet: rob@dssmktg.com | Tel: 714.771.0454 | (| ^ |)
bangpath: uunet.uu.net!dssmktg!rob| Fax: 714.771.3028 | \\`-'/
#include <disclaimer.h> SURF'S UP \\_/