473,385 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

how to create a db2 triggers to copy one filed to another in same table before update

Hi. I am new to writing code and wanted some help or suggestions.

I am trying to write a script to put calculation results into a filed after update of item.

I tried.
CREATE TRIGGER TRA_Declared_value_Update
AFTER UPDATE ON TLORDER
FOR EACH ROW
MODE DB2SQL
UPDATE TLORDER set DECLARED_VALUE = ROUND((CHARGES + XCHARGES - INT_PAYABLE_AMT),2)

and also

CREATE TRIGGER NEW_DECLARED_VALUE
AFTER UPDATE OF DECLARED_VALUE ON TLORDER
REFERENCING NEW AS N OLD AS O
FOR EACH ROW
MODE DB2SQL
BEGIN ATOMIC
SET N.DECLARED_VALUE = ROUND((N.CHARGES + N.XCHARGES - N.INT_PAYABLE_AMT),2);
END

they both hang system. can anyone help.
Oct 28 '14 #1
0 1098

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

Similar topics

6
by: dev | last post by:
how create a temp table as a copy of a existing table and then update1 field and insert the hole temp table back in the existing table? please any help? if i have 10 fields in 1 record and...
1
by: James Chang | last post by:
Hello, I am writing an application using Visual Studio .NET (C#). The application will be run on several workstations simultaneously, and all of them will be accessing a single sql server...
1
by: Bill | last post by:
I have a column of digits I'd like to copy into another column in the same table. How would I do this? Thanks, Bill
5
by: Peter CCH | last post by:
Let's say, I have Table1 and Table2, both with the exactly same structure and data in it, except that Table1.Field1 is empty in data but Table2.Field1 have data in it. How could I copy all the...
2
by: TheTamdino | last post by:
Hello all, I've tried to work this one out myself, but appearantly my brain is just a little wacked right now and I need some feedback. I'm trying to design a genealogy database (mainly...
10
by: Lars Grøtteland | last post by:
Hello! Was wondering how I can create a copy of one database? FYI I'm not interrested in the data, just the fields and triggers, and so on. Which way is the easiest? Do I create a script and...
6
by: polocar | last post by:
Hi, I'm writing a program in Visual C# 2005 Professional Edition. This program connects to a SQL Server 2005 database called "Generations" (in which there is only one table, called...
1
by: sudhendra | last post by:
I have a table supertask; which has 24 rows. The table as a primary_key called id. I would like just recursively copy rows into same table. supertask_id is auto generated. So All I need to do is...
1
by: nassim.bouayad.agha | last post by:
Hello, here is my table declaration : CREATE TABLE staff_member( pay_id varchar(64) NOT NULL default '', manager_pay_id varchar(64), location_name varchar(64), first_name varchar(64) NOT NULL...
0
by: nassim.bouayad.agha | last post by:
Hello, here is my table declaration : CREATE TABLE staff_member( pay_id varchar(64) NOT NULL default '', manager_pay_id varchar(64), location_name varchar(64), first_name varchar(64) NOT NULL...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.