473,811 Members | 2,756 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trigger to reflect changes

1 New Member
Hi,

I have created a trigger as below to update a table called vnd_trail to show what sort of operation(updat e/delete) happened to the name column. My problem is, I want to have another column to show the changes that took place. For example name field: maxim systems has been changed to maximus system. How can I do that in my trigger below?

CREATE TRIGGER vnd_chk
AFTER UPDATE OR DELETE ON vnd
FOR EACH ROW
DECLARE
oper varchar2(8);
ruid number;
name varchar2(64);
name_change varchar2(64);

BEGIN
if updating then
oper:='update';
end if;

if deleting then
oper:='delete';
end if;

/*store previous value into vnd_trail*/
ruid:=:old.ruid ;
name:=:old.name ;
insert into vnd_trail
values(ruid,nam e,oper,sysdate, name_change);
END;

thank you for any advice.
Jul 17 '06 #1
1 2668
masdi2t
37 New Member
Hi,
let's say that you have another column named 'desc',
you need a little modification on your trigger

CREATE TRIGGER vnd_chk
AFTER UPDATE OR DELETE ON vnd
FOR EACH ROW
DECLARE
oper varchar2(8);
ruid number;
name varchar2(64);
name_change varchar2(64);

/* additional */
desc varchar2(255);

BEGIN
if updating then
oper:='update';

/* additional */
desc := concat('value: ', old.name, ' was changed to: ', new.name);
end if;

if deleting then
oper:='delete';

/* additional */
desc := concat('value: ', old.name, ' was deleted');
end if;

/*store previous value into vnd_trail*/
ruid:=ld.ruid;
name:=ld.name;
insert into vnd_trail
values(ruid,nam e,oper,sysdate, name_change, /* additional */desc);
END;
Jul 27 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
5805
by: Tushar | last post by:
Hello, I am working on a client server application involving TOMCAT as Web server, MySQl as the DB and combination of JSP, Servlet, and JavaBeans to access and write Data back. There is another piece of the project (out side my scope of development) that writes to the Same MySQL tables and make changes to the data.
0
1560
by: Gill Bates | last post by:
so DOM calls should be calculated from Diff. Possible? How? (some URLs please) I guess this is in most cases not very efficient, but here's why: I have a data Document at the server. From this document, views (HTML, SVG, GIF, etc) can be generated and sent to the client.
2
4934
by: Mike | last post by:
Hi, I am strugling with a simple problem which I can't seem to resolve. I have an asp.net page which contains a server-control (flytreeview, which is a kind of a tree to be exact). The tree is being updated by some other process through remoting. When the page loads, I init the tree, and in my browser I can see the initialized tree. The problem is that every time that I receive update to tree from the remote process,
1
2389
by: =?Utf-8?B?QnJhbmRvbg==?= | last post by:
Hi, I have an aspx page that contains an include section which calls an html page for text to be displayed on the aspx page. I also have an upload page that allows users to upload a simple html page with the same name everytime and places it on the server. My problem is that the aspx page does not update to reflect the changes made to the uploaded html page. However, if I log into the server and open the aspx page that contains the code...
0
1105
by: AliRezaGoogle | last post by:
Dear members, I have a datagrid and a textbox on my form. I bound both of them to a common datasource( an arbitrary datatable). When I change a text inside textbox I expect that value of same column in datagride also change and be equal to new value entered inside textbox. But this change reflects to datagrid just when I change selected row in the datagrid.
2
2461
by: ejamnadas | last post by:
I have an unbound form, whose combobox and textboxes are also unbound. The form's record source is a query (getdata) . It has combo box whose rowsource is the same query. The afterupdate event for the combobox assigns a column from the query, (Document_Control_Number), + 1, to a textbox in the form. When the form is submitted, the values are added into the table, but when I make a selection in the combobox, it does not use the updated...
0
1959
by: \Ji Zhou [MSFT]\ | last post by:
Hello Ashutosh, I see your points. As to your two new concerns, I am give the detailed comments in the following. 1. Is it possible to achieve this result without calling Update on the route table? I want to give the user an option to save/reject the changes. Yes, we can achieve the objective without calling the Update function on the route table. The necessary thing we need to do is updating the
1
2388
by: amitjaura | last post by:
Well i have a datagridview in my application and i want it to reflect any changes made in server database instantly with some trigger or so? I have a choice to use timer and get the desired results by binding datagridview after every 5 sec's or so but i dont want to do this .As it ll affect the performanc e of my application.Please suggest a better way out......
3
1400
by: kiranvn31 | last post by:
Hi My flash file get images from one folder with C# code file I changes the image in the folder dynamically on button click flash not show changes on post back but when I close IE and run page then flash reflect changes pls help Thank You
0
9727
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10386
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10398
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9204
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7669
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5554
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4339
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.