Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Oracle Time Stamp

Posted on 1998-05-10
4
Medium Priority
?
1,410 Views
Last Modified: 2008-02-01
Is there a way we can put a column in 'history' table that would keep the time, at which transaction x was commited?
0
Comment
Question by:kgkhan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
xiaodong earned 200 total points
ID: 1080979
Absolutely.
Add a colume with data type of Date.
Whenever you insert/update a record, insert/update the column with the value of sysdate.
0
 
LVL 2

Expert Comment

by:manand062397
ID: 1080980
As Xiaodong said add new field for date field and do the followings

1. Use Trigger to update new field automatically on insert/update of record.

2. If you do not update records in history table then user default sysdate to update date and time of insertion.  

If you do not update history records then I recommend second method because there is no coding.
0
 
LVL 4

Expert Comment

by:sganta
ID: 1080981
You follow the following steps

1. To include column in the history table using the following syntax
    SQL >     ALTER TABLE history ADD (record_date DATE);
2. Now write a DATA BASE TRIGGER for history which will take care to insert or update
   the  RECORD_DATE by using the following SYNTAX

   CREATE TRIGGER history_trigger
   BEFORE INSERT OR UPDATE ON history FOR EACH ROW
   BEGIN
       :NEW.record_date := SYSDATE;
   END;
3. Execute the above trigger which will fire whenever you insert or update the record
   and change the  update the committed time accordingly.

Since the question is locked, I could'nt able to answer you.

This is tested and it works fine
I hope this is acceptable to you - sganta


0
 
LVL 4

Expert Comment

by:sganta
ID: 1080982
Hello !

I have posted my answer as a comment. Since the Question is locked, I could'nt able
to put in to answer column.

If you are interested in xiaodong's answer please accept this. Otherwise
reject this. If you are not interested in my answer (comment). Send a comment
so that another expert can give better solution. You've taken so much time.
What happened ?
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question