SQL Help - update query with two tables

Bryan O'Neal BONeal at cornerstonehome.com
Fri May 23 20:54:01 MST 2008


Ok, I am trying to use cursors but I am not having any successes

DECLARE C1 CURSOR WITH HOLD FOR 
SELECT ACCOUNT_ID, DEPOSIT
FROM B
FOR UPDATE OF A
DO UNTIL SQLCODE = 100
FETCH C1
INTO :ACCOUNT-VAR, :DEPOSIT-VAR
UPDATE A
	SET CURRENT_BALANCE = CURRENT_BALANCE + : DEPOSIT-VAR
	WHERE ACCOUNT_ID = :ACCOUNT-VAR
END-DO

But no dice.  Can I get a primer on how to do this?

-----Original Message-----
From: plug-discuss-bounces at lists.plug.phoenix.az.us
[mailto:plug-discuss-bounces at lists.plug.phoenix.az.us] On Behalf Of
Joseph Sinclair
Sent: Friday, May 23, 2008 7:21 PM
To: Main PLUG discussion list
Subject: Re: SQL Help - update query with two tables

Sorry, hit send before rewriting to match your query:
UPDATE A Set (CURRENT_BALANCE) = (SELECT A.CURRENT_BALANCE + B.DEPOSIT


More information about the PLUG-discuss mailing list