0% found this document useful (0 votes)
28 views3 pages

Steps: @e:/shilpa/changelog - Trig - SQL

1) Create a folder called "shilpa" and copy a trigger script file to it, changing any schema names as needed. 2) Run the trigger script to create a trigger that logs changes to tables to the changelog_dtls table. 3) Make a change to a record in the currency table and check that the previous and new values were captured in the changelog_dtls table as expected.

Uploaded by

Dinesh Kumar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views3 pages

Steps: @e:/shilpa/changelog - Trig - SQL

1) Create a folder called "shilpa" and copy a trigger script file to it, changing any schema names as needed. 2) Run the trigger script to create a trigger that logs changes to tables to the changelog_dtls table. 3) Make a change to a record in the currency table and check that the previous and new values were captured in the changelog_dtls table as expected.

Uploaded by

Dinesh Kumar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Steps Create a folder shilpa on any local drive e.g.

I have created on e: Copy the trigger script file changelog_trig.sql to shilpa folder. Note : Open the script and change the column/table names as per your schema.

1) Run the following script on sql prompt SQL> @E:\shilpa\changelog_trig.sql Trigger created.

Example

---Testing : we are going to change the currency name filed and check the changed in old and new fields. Step-1 select * from currency

Step-2 Now check if there are any records in changelog_dtls table SQL> select field_name, prev_value, chngd_value, form_desc from changelog_dtls;

Output no rows selected

Step-3 update currency_name to INR Rupee India UPDATE CURRENCY set CURRENCY_NAME = 'INR Rupee - India' where currency_code = 'INR' Commit/Save the Record Important Step-4 Again review the changelog_dtls table select field_name, prev_value, chngd_value, form_desc from changelog_dtls;

Notice: This time there is one record inserted. Also check that PREV_VALUE and CHNGD_VALUES are as expected. Step-5 Now just go back and lets check the original table, there the currency_name will be as INR Rupee India

----

This is for just checking for a single column; weve to work on do for all column. Will do it as well.

You might also like