Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8789405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:23:47+00:00 2026-06-13T22:23:47+00:00

I have a table with various fields that can be updated. Let’s called it

  • 0

I have a table with various fields that can be updated. Let’s called it table1 and assume it has these fields:

user VARCHAR2
first_name VARCHAR2
last_name VARCHAR2

My question: I want to keep track of edits to these fields. I have an application that allows these fields to be updated but I want to keep track of when a field is edited, who edited the field and which field was edited – the which is the bit I need help with.

I could have a history table:

date_edited DATE
who_edited VARCHAR2
field_name_edited VARCHAR2

what if the field name got changed though?.. It would mean that field_name_edited would refer to a non-existent field. This seems like a silly approach.

There must be some common way of doing this sort of thing?

Many thanks.

EDIT

I am using an Oracle DB – see new question tags.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T22:23:49+00:00Added an answer on June 13, 2026 at 10:23 pm

    “There must be some common way of doing this sort of thing?”

    Not really, because your approach is a common but misguided one. Tracking changes at the column level is unsatisfactory for several reasons:

    1. It gets expensive when an update touches several columns (inserting multiple audit records for each updated row).
    2. It’s hard to assemble a coherent picture of the state of the record at a given point in time (programmatically complex, and more expensive to boot).
    3. There’s no elegant way to test whether a given column has been changed.
    4. Storing the column value is messy (implementations usually handle different data-types by converting them to strings).

    (Your suggested table doesn’t deal with that last point, which I presume is an oversight: there’s little value to an audit trail which doesn’t track the changed values).

    So, what is the common solution? Row-level history tables. With triggers which insert the whole record into the journalling table (together with those metadata columns like DATE_EDITED and WHO_EDITED). These triggers can easily be generated from the data dictionary.

    It is true that this approach makes it harder to spot which columns were edited in any given transaction. However:

    1. it is hard but not impossible to do this. It can be implemented in SQL (using analytic LAG or something) but actually the human being is pretty good at spotting changes unaided.
    2. the cost of this is borne by the audit sub-system, which in real life – and regardless of what the requirements say – will not be used much, and certainly much less than the core part of the application. So it is better to offload processing costs on to the audit sub-system, rather than making the journalling expensive.

    And, as I said, row-level journalling incurs lower costs than column-level both in generating the audit records and retrieving them.


    In your comment you link to a piece about Oracle’s Total Recall product. This is actually a very elegant solution, which has a very low impact on the main system, and which makes it easy to recover the historical state of our tables. The problem is, prior to 12c it is a chargeable extra to the Enterprise Edition which makes it expensive. (In fact it is now part of the Advanced Compression option rather than a separate product in its own right). In 12c Basic Flashback Data Archive (the new name for Total Recall) is available in all editions, but we still need to buy the Advanced Compression Option to compress the journalling tables.


    “You recommend [to store] row edits and thus, store redundand data. “

    Yep. Storage is usually cheap these days. The cost of storing redundant data is usually a good price to pay for efficient writing and retrieval of records.

    ” You still need to copy the literal names of the original columns”

    Journalling uses one audit table for each data table; the audit table matches the structure of the live table, with some additional columns to hold metadata relating to the transaction. We would expect the audit columns to have the same names as their analogous data columns. (Doing anything else would be stupid, not least because we can generate DDL for the audit tables from the data dictionary.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have a table with a Color column. Color can have various
I have table called location with a field area. This field can contain various
I am importing massive amounts of data from Excel that have various table layouts.
I have a table that stores various clients I have done work for, separated
I have an application that loads a cell in various table views. I want
I have an ms-access database called db.mdb and it contains various table. I;m creating
I have a MySQL table that holds many entries with repeated IDs (for various
I have a Yahoo! Group that has its own Database tables for various reasons.
I have an object that has X number of fields. Each row in my
I have a table called location with a field area . This field can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.