Subject | only first record gets updated in my stored procedure ?? |
---|---|
Author | michael635584 |
Post date | 2007-03-01T07:33:10Z |
Below I have a simple procedure that gets called from a trigger (
after update on another table)
However - if I change ILINK to an OUTPUT variable ( to see if all the
records are being stepped through - it works and updates all 4
records)
If I just leave it as a variable ( which is what I want - I don't
want any output ) only the FIRST record of Field AMOUNTS of the 4
records gets updated?
Firebird 1.5 - running with Delphi and testing with ibExpert. Its the
same whether I run it from Delphi - or just test in IBExpert.
Can anyone tell me what I am doing wrong?
CREATE PROCEDURE UPDATEAMOUNTS (
IHLINK INTEGER,
DBLAMOUNT DOUBLE PRECISION)
AS
DECLARE VARIABLE ILINK BIGINT;
begin
for select bj.HLINK from bJointable bj where
bj.bLink = :ihLink
into :iLink
do
begin
/* all 4 records get updated ONLY IF I make ILINK an output var */
update cust c set amounts = :dblAmount where c.hlink = :ilink;
/* otherwise only the FIRST record is updated */
suspend;
end
after update on another table)
However - if I change ILINK to an OUTPUT variable ( to see if all the
records are being stepped through - it works and updates all 4
records)
If I just leave it as a variable ( which is what I want - I don't
want any output ) only the FIRST record of Field AMOUNTS of the 4
records gets updated?
Firebird 1.5 - running with Delphi and testing with ibExpert. Its the
same whether I run it from Delphi - or just test in IBExpert.
Can anyone tell me what I am doing wrong?
CREATE PROCEDURE UPDATEAMOUNTS (
IHLINK INTEGER,
DBLAMOUNT DOUBLE PRECISION)
AS
DECLARE VARIABLE ILINK BIGINT;
begin
for select bj.HLINK from bJointable bj where
bj.bLink = :ihLink
into :iLink
do
begin
/* all 4 records get updated ONLY IF I make ILINK an output var */
update cust c set amounts = :dblAmount where c.hlink = :ilink;
/* otherwise only the FIRST record is updated */
suspend;
end