473,395 Members | 1,377 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,395 software developers and data experts.

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

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 1649
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
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
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
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
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
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
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
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
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
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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...
0
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...
0
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
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...

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.