H wrote:
>
> There is great satisfaction in reading the docs or searching
> the archive to find the solution to your problem.. That being
> said I just don't have the time... I am under a tight
> deadline for a project... I took a decent look at the
> archive but cant find search words to isolate what I need....
>
> Here is what I want...
> a) A date and time record of when a new row in a table was
> INSERTED or UPDATED in a table.
>
> Here is how I think it should be done (pseudo-code) need the
> real code fore this. I am certain its been written 100 times
> before - if someone would be so kind as to cut and paste it for me ..
>
> psuedo code
>
> Trigger on Table Customer
> Before Insert or Update
> Set DateField = Today()
> Set TimeField = Now()
>
> Kind Regards,
>
>
Before-trigger are not available in MaxDB, you have to use after-row-trigger, if
triggers are needed.
For the insert-case no trigger is needed, as you can set
the default for the table to DATE/TIME/TIMESTAMP (if this value has to be stored
in the inserted row, not in another row.)
For the update-case a trigger has to be used anyway.
The answer of Jean-Michel Oltra seems to be ok, but a little bit overkill:
INSERT INTO JM.HISTORIQUEGARANTIEINTRANT VALUES
(
:OLD.IDGARANTIE,
:OLD.IDINTRANT,
:OLD.IDETABLISSEMENT,
(SELECT DATE FROM SYSDBA.DUAL),
:OLD.DEBUTGARANTIE,
:OLD.FINGARANTIE
);
why is this not done easier?
INSERT INTO JM.HISTORIQUEGARANTIEINTRANT VALUES
(
:OLD.IDGARANTIE,
:OLD.IDINTRANT,
:OLD.IDETABLISSEMENT,
DATE, <----
:OLD.DEBUTGARANTIE,
:OLD.FINGARANTIE
);
DATE/TIME/TIMESTAMP are 'values' which can be used in insert/update/select,
not only in select-lists of selects to SYSDBA.DUAL.
Elke
SAP Labs Berlin
>
>
> ---------------------------------
> Post your free ad now! Yahoo! Canada Personals
>
--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]