473,498 Members | 2,018 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I need help creating an AFTER UPDATE trigger to add an ‘UP’ record to the Log every t

2 New Member
Expand|Select|Wrap|Line Numbers
  1. CREATE TRIGGER UPDATE_ACCOUNT                                       
  2.   AFTER UPDATE ON ACCOUNT                                            
  3.   REFERENCING UPDATE AS U                                            
  4.   OLD AS O                                                           
  5.   FOR EACH ROW MODE DB2SQL                                           
  6.   BEGIN ATOMIC                                                       
  7.   UPDATE LOG                                                         
  8.     (LOD_ID,LOG_ACCT_ID, LOG_BRAN_ID, LOG_EMP_ID,LOG_BAL_CNY_BEF,    
  9.      LOG_BAL_CNY_AFT, LOG_BAL_USD_BEF, LOG_BAL_USD_AFT, LOG_TRAN_TYPE
  10.      LOG_TRAN_TIME)                                                  
  11.  VALUES(NEXT VALUE FOR KC03MFE.SQ4LOG,                               
  12.    U.ACCT_BRAN_ID, U.ACCT_EMP_ID, 0, U.ACCT_BAL_CNY, 0,              
  13.    U.ACCT_BAL_USD, U.ACCT_CUST_ID, 'UP', U.ACCT_OPEN_TIME);          
  14.  END@  

I think my syntax is off in the update?? DSNT408I SQLCODE = -199, ERROR: ILLEGAL USE OF KEYWORD UPDATE.
May 1 '15 #1
1 1650
shardt01
2 New Member
I need to create an AFTER UPDATE trigger to add an ‘UP’ record to the Log every time an ac-count is updated (money deposited or withdrawn).
May 1 '15 #2

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

Similar topics

7
21442
by: Justin | last post by:
I am extremely new at SQL Server2000 and t-sql and I'm looking to create a simple trigger. For explanation sake, let's say I have 3 columns in one table ... Col_1, Col_2 and Col_3. The data type...
1
6120
by: Gent | last post by:
am using FOR UPDATE triggers to audit a table that has 67 fields. My problem is that this slows down the system significantly. I have narrowed down the problem to the size (Lines of code) that need...
1
2190
by: m3ckon | last post by:
Hi there, I'm a little stuck and would like some help I need to create an update trigger which will run an update query on another table. However, What I need to do is update the other...
1
15385
by: shottarum | last post by:
I currently have 2 tables as follows: CREATE TABLE . ( mhan8 int, mhac02 varchar(5), mhmot varchar(5), mhupmj int )
1
4060
by: Simon Holmes | last post by:
Hi, I am having trouble calling a UDF from a 'before update' trigger whereas I have no problems calling it from the 'after update' trigger. The trigger is as below : CREATE TRIGGER foo NO...
0
2991
by: gshawn3 | last post by:
Hi, I am having a hard time creating a Trigger to update an Oracle database. I am using a SQL Server 2005 Express database on a Win XP Pro SP2 desktop, linked to an Oracle 10g database on a...
2
2097
by: mayankaswal | last post by:
I am trying to create a AFTER INSERT Trigger. I created it and it worked for one record. But when I am trying to input multiple inserts it gives me error even on my insert statement. I am sure the...
4
5618
by: Mikep99 | last post by:
I am new to access and need some help with coding. I have a main form XYZ with 2 subforms. I have a checkbox on subform1 "frmExpediteS" that when checked i would like the Value in Feild "PO" of this...
1
1533
by: Pacco sekka | last post by:
I have create a trigger to insert values into a table from another existing table after an update is made to a 3rd table. But when I run the Update statement to fire the trigger, twice as many rows...
0
7121
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
6993
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...
1
6881
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...
0
7375
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4899
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...
0
4584
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3088
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...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
287
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.