My requirment is i need check type ='ABC' need iterate each Hab element
if get same ref in iteration need to update npice else i need to added to new row datatype
I am pasting code snipet as below update check is not happening.
DECLARE tempDngGdsCnt ROW;
DECLARE intTempRow INTEGER;
DECLARE npcs INTEGER;
DECLARE shipref CHARACTER;
DECLARE intShipRef INTEGER;
DECLARE intShipStmt INTEGER;
SET intTempHawbVal=1;
SET intShipStmt = 1;
WHILE LASTMOVE(refToHawb) DO
IF(refToHawb.ShipperRef.Qualifier='DGS')THEN
SET npcs = CAST(SUBSTRING(refToHawb.NumberOfPieces BEFORE '/') AS INTEGER);
SET shipref = refToHawb.ShipperRef.ShipmentRef;
SET intShipRef =CARDINALITY(tempDngGdsCnt.shipref[]);
DECLARE bolExist BOOLEAN FALSE;
PROCESS1: WHILE (intShipStmt<=intShipRef) DO
IF tempDngGdsCnt.shipref[intShipRef].value = shipref THEN
SET tempDngGdsCnt.shipref[intShipRef].Value = shipref;
SET tempDngGdsCnt.npcs[intShipRef].Value = CAST(tempDngGdsCnt.npcs[intShipRef].Value AS INTEGER)+npcs;
SET bolExist = TRUE;
LEAVE PROCESS1;
END IF;
SET intShipStmt= intShipStmt+1;
END WHILE;
IF NOT bolExist THEN
SET intShipRef = intShipRef + 1;
SET tempDngGdsCnt.shipref[intShipRef].Value = shipref;
SET tempDngGdsCnt.npcs[intShipRef].Value = npcs;
END IF;
END IF;
SET intTempHawbVal = intTempHawbVal+1;
MOVE refToHawb NEXTSIBLING REPEAT TYPE NAME;
END WHILE;
Posted: Mon Oct 06, 2014 5:44 am Post subject: Re: Need help on ROW datatype
Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
anilmekala wrote:
I am pasting code snipet as below update check is not happening.
Well, if you'd used c o d e tags it would be easier for everyone to read, including you. Then you might have seen:
Code:
IF tempDngGdsCnt.shipref[intShipRef].value = shipref THEN
SET tempDngGdsCnt.shipref[intShipRef].Value = shipref;
SET tempDngGdsCnt.npcs[intShipRef].Value = CAST(tempDngGdsCnt.npcs[intShipRef].Value AS INTEGER)+npcs;
SET bolExist = TRUE;
LEAVE PROCESS1;
END IF;
The IF tests for value but the code sets Value.
By the way, never use indexes for this kind of thing; horribly inefficient. Use references. _________________ Honesty is the best policy.
Insanity is the best defence.
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
Or better still use a SELECT to identify all the type=ABC and process them as a block. _________________ Honesty is the best policy.
Insanity is the best defence.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum