Hi everyone I am a bit new to PL/SQL so am a bit confused. I have a Cursor called rec and while looping through it I have two nested IF statements.
CURSOR Cur IS
SELECT Mil.Id,
Mil.Record_Num,
Mil.Status,
Mil.file_processed,
Mil.Updated_By
FROM status_log mil
WHERE Mil.file_processed != 'Processed'
For Update of Mil.file_processed;
FOR Rec IN Cur LOOP
IF (Rec.status = 'Ready' OR Rec.status = 'Go') THEN
IF Length(Rec.Zip) = 5 AND
(Substr(Rec.Zip, 1, 3) = '303' OR
Substr(Rec.Zip, 1, 3) = '304' ) THEN
l_state:= 'ATL';
END IF;
UPDATE status_log mil
SET file_processed = 'Processed'
WHERE current of cur
END IF;
COMMIT;
END LOOP;
Now whenever the cursor has one record that satisfies the second IF(i.e Zip is 5 in length and the code starts with 303 or 304) it doesnt hit the update statement anymore for that records and all record after that. I even tried using the EXIT statement after the logic in the IF loop but to no avail. What am I doing wrong?
exception when others then null;)exception when othersblock is a notification that the block has been hit but the exception is not being hit.