Hi,

Is it possible to change the values of certain rows that are inserted into
the database? Let say I have a col that records the date the row it was
entered. On insert I want to set it, and on update I want to make sure
it's never altered. Also I have a col that records the date it was last
changed.

I have some experiance with postresql and oracle though and in Oracle I
would do:

CREATE OR REPLACE TRIGGER foo BEFORE INSERT OR UPDATE ON bla
yada yada yada FOR EACH ROW
BEGIN
  IF INSERTING THEN :NEW.date_create:=SYSDATE();
  ELSE :NEW.date_create:=:OLD.date_create;
  END IF;
  :NEW.date_lch:=SYSDATE();
END;

Now I'm 'stuck' in sqlite without the powerfull features of full-blown
procedural languages... And I don't know what to do?!? :)

Don't get me wrong; I'm faling in love with sqlite for what it is, and not
trying to compare it to (e.g.) Oracle. But something simmilar to the above
must be possible in plain SQL also?

Regards,
Mark

Reply via email to