Re: 4GL Update is updating ALL rows, Help!
Posted in 1994
Dave Lutz writes:
> Please post the code showing the cursor declaration, select and
> update statements.
Here it is; THANKS for looking at it...
####################### begin code segment #############################
LET ci_ord_sel = "SELECT * FROM order_detail WHERE order_id = ? AND ",
"line_number = ? FOR UPDATE "
PREPARE ord1qry FROM ci_ord_sel
DECLARE ord1_curs CURSOR FOR ord1qry
#[function call to begin transaction here]
OPEN ord1_curs USING orderid, linenumber
FETCH ord1_curs INTO ci_ord_d.*
IF status = 0 THEN # order detail exist
#[code deleted here ]
UPDATE order_detail SET (t_quantity, r_quantity, p_quantity,
back_order) =
(ci_ord_d.t_quantity, ci_ord_d.r_quantity,
ci_ord_d.p_quantity, ci_ord_d.back_order)
WHERE CURRENT OF ord1_curs
#[code deleted here ]
END IF # order detail exist
CLOSE ord1_curs
#[function call to end transaction here]
###################### end code segment #########################
--
Joan Armstrong
CIM Engineering, Hewlett Packard, Vancouver
Internet: joana@vcd.hp.com
HPDesk: Joan Armstrong /HP5400/AL