4

Can anyone see why I'm getting the "No current record for fetch operation" below?

I'm successfully skipping duplicate records by catching and not re-throwing the unique key violation exception below. There is another error however.

FOR SELECT 
  ...
FROM
  P_SELECT_CLAIM_FILE cf
ORDER BY
  cf.DATESBM, cf.TIMESBM, cf.TRANSCDE
INTO
  ...variables
DO BEGIN

  INSERT INTO
   CLAIM_TABLE (...)
    VALUES (...variables);

  WHEN GDSCODE unique_key_violation DO
    TX_ID=0;

  WHEN GDSCODE no_cur_rec DO
    /* Why does this happen?
      -508 335544348 no_cur_rec No current record for fetch operation 
    */
    EXCEPTION E 'no_cur_rec ' || TX_ID;

END

The procedure P_SELECT_CLAIM_FILE contains another FOR SELECT INTO with lots of trimming and finally a SUSPEND command. This reads from a fixed width text file.

I'm tempted to change this into a single INSERT SELECT where not exists statement. I prefer to make a minimal fix instead however; the holidays already here.

jcalfee314
  • 4,642
  • 8
  • 43
  • 75
  • Update, I found a BEFORE INSERT trigger causing the problem. The cursor exception goes away when I disable it. Strange, it is only selecting a value into a NEW variable. – jcalfee314 Dec 20 '12 at 20:47
  • 1
    as i remember there was a bug in older versions of Firebird related to "no current record". Try at least to simulate your scenario on FB 2.5 and make conclusions. – Marcodor May 08 '13 at 07:11

0 Answers0