Subject Incorrect exception generated by Firebird
Author Rick Debay
My exception handler is not catching this message. The error occurs
because the unique constraint is being violated. Instead of getting an
-803 SQLCODE, I'm getting 'no current record for fetch operation'

ISC ERROR CODE:335544348
ISC ERROR MESSAGE:
no current record for fetch operation
violation of PRIMARY or UNIQUE KEY constraint "U_RPLCLMPOBILLITM_PK"
on table "RPL_CLM_POBILL_ITM"

BEGIN
INSERT INTO RPL_CLM_POBILL_ITM (
POBILL_ITM,
CLAIM_ID,
QTY_CLAIM,
QTY_SHIP,
CREATED)
VALUES (
:POBILL_ITM,
:CLAIM_ID,
:QTY_CLAIM,
:QTY_SHIP,
:POSTED);
WHEN SQLCODE -803 DO
UPDATE RPL_CLM_POBILL_ITM SET
QTY_CLAIM = QTY_CLAIM + :QTY_CLAIM,
QTY_SHIP = QTY_SHIP + :QTY_SHIP
WHERE
POBILL_ITM = :POBILL_ITM AND
CLAIM_ID = :CLAIM_ID AND
GRANTEE_INVC IS NULL;
END

The server version is LI-V6.3.1.4481 Firebird 1.5