Hi there
I have a newbie question. I have this code in a stored procedure. Does somebody tell me what the fetch does? I know that it's a kind of array but...I don't know more than that. I need to do the same kind of thing with a table that it's called TblLot which has fields Item and Lot. It can have many lot for 1 item. So I guess that it's the good command to use for extract that and put it in the same variable right? Could you please help me with this?!
Thanks in advance
DECLARE SerialCrs CURSOR LOCAL STATIC FOR
SELECT
serial.RowPointer
, serial.ser_num
FROM serial
INNER JOIN ser_track
ON ser_track.ser_num = serial.ser_num
AND ser_track.track_num = @MatltrackTrackNum
WHERE serial.stat = 'O'
AND serial.item = @MatltrackItem
OPEN SerialCrs
WHILE @Severity = 0
BEGIN
FETCH SerialCrs INTO
@SerialRowPointer
, @SerialSerNum
IF @@FETCH_STATUS = -1
BREAK
I have a newbie question. I have this code in a stored procedure. Does somebody tell me what the fetch does? I know that it's a kind of array but...I don't know more than that. I need to do the same kind of thing with a table that it's called TblLot which has fields Item and Lot. It can have many lot for 1 item. So I guess that it's the good command to use for extract that and put it in the same variable right? Could you please help me with this?!
Thanks in advance
DECLARE SerialCrs CURSOR LOCAL STATIC FOR
SELECT
serial.RowPointer
, serial.ser_num
FROM serial
INNER JOIN ser_track
ON ser_track.ser_num = serial.ser_num
AND ser_track.track_num = @MatltrackTrackNum
WHERE serial.stat = 'O'
AND serial.item = @MatltrackItem
OPEN SerialCrs
WHILE @Severity = 0
BEGIN
FETCH SerialCrs INTO
@SerialRowPointer
, @SerialSerNum
IF @@FETCH_STATUS = -1
BREAK