Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2004
    Location
    Cergy
    Posts
    65

    Question Unanswered: How can I add a timestamp ?

    How can I know when a record is modified ?

    I want to add a field and fill it with date/time when it is modified.

    Thanks

  2. #2
    Join Date
    Jul 2003
    Posts
    2,296
    why not use Oracle Auditing?

    Look up AUDIT_TRAIL parameter in the Oracle Docs
    Last edited by The_Duck; 05-06-04 at 11:45.
    - The_Duck
    you can lead someone to something but they will never learn anything ...

  3. #3
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    136
    Hi!
    You can create an BEFORE UPDATE - TRIGGER like this:
    PHP Code:
    CREATE SEQUENCE yourSEquence;
    -------------------------------------------------------
    CREATE OR REPLACE TRIGGER yourTrigger 
    BEFORE UPDATE ON yourTable
    REFERENCING 
    NEW AS NEW OLD AS OLD FOR EACH ROW
    DECLARE
         Var 
    NUMBER;
    BEGIN
         
    Var := 0;
      
    SELECT yourSequence.NEXTVAL INTO Var FROM DUAL;
        :NEW.
    CHANGED_ON := SYSDATE;
    END
    Regards,
    Julia

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •