Using a For Select Do, with a pre-determined limited amount of rows, not working correctly

48 views Asked by At

This proc I have in interbase runs too slow. It takes a 10th of a second to run, yet for 2.5 million rows, it will take 2 entire days (the math adds up I guess)

Can't have the client's database down for 2 days, so I decided we'd just run the proc on a select range of rows at a time, which would decidedly take less time, and be done afterhours over the span of a few days every night. For some reason, while it looks like it's running fully with no errors, the proc does nothing.

  for select custid, areacode, primarytel, PRIMARYTELID 
    from customers 
    where (primarytelid || '' is null or primarytelid || '' = '')
    and areacode is not null and areacode <> ''
    and primarytel is not null and primarytel <> ''
    rows 10
    into :custid, :AREACODE, :primarytel,:PRIMARYTELID do
  begin
    select primarytelid from PHONENUM_REFRESH(:CUSTID,:AREACODE,:PRIMARYTEL,'') into :primarytelid;
    update customers set primarytelid = :primarytelid where custid = :custid;
  end

In this example I purposely put to process first 10 rows only, so I could monitor it. But the proc does nothing, it doesn't update anything. It just ends and nothing was changed. This proc runs just fine without the ROWS statement, which is why i'm confused now. Is there something incompatible with this setup? Would I achieve what i want differently?

0

There are 0 answers