Hi guys, I have a looping problem that I can't find right now.
This is the sql query when I execute this code:
SELECT iogc_instrument.instrument_number, iogc_instrument.iogc_agreement_number FROM ilrs.iogc_instrument WHERE iogc_instrument.instrument_number IN ('2190301020001860','2190301020001863','2000000000005738','2000000000005739')
union SELECT iogc_instrument.instrument_number, iogc_instrument.iogc_agreement_number FROM ilrs.iogc_instrument WHERE iogc_instrument.instrument_number IN ('2190301020001860','2190301020001863','2000000000005738','2000000000005739'.....goes to 254 values)
WHERE iogc_instrument.instrument_number IN ('2190301020001860','2190301020001863','2000000000005738','2000000000005739'.....goes to 254 values)
union SELECT iogc_instrument.instrument_number, iogc_instrument.iogc_agreement_number FROM ilrs.iogc_instrument WHERE iogc_instrument.instrument_number IN ('2190301020001860','2190301020001863','2000000000005738','2000000000005739'.....goes to 254 values)
WHERE iogc_instrument.instrument_number IN ('2190301020001860','2190301020001863','2000000000005738','2000000000005739'.....goes to 254 values)
This is the code I have.
dim arrWords, iLen, icounter, counter, inValues
arrWords = split(strInstruments,","
arrWords2 = split(strReserves,","
icounter = 0
counter = 0
invalues = ""
'An other test solution
do while icounter <= ubound(arrwords2)
if counter < 253 and icounter < ubound(arrwords2) then
invalues = invalues & arrwords2(icounter) & ","
elseif counter = 254 or counter = ubound(arrwords2) then
invalues = invalues & arrwords2(icounter)
end if
if icounter = ubound(arrwords2) then
tempSql = tempSql & strSQL & " AND band_reserve.reserve_number IN ('" & invalues & "')"
elseif counter = 254 then
tempSql = tempSql & strSQL & " AND band_reserve.reserve_number IN ('" & invalues & "') union "
invalues = ""
counter = 0
end if
icounter = icounter + 1
counter = counter + 1
loop
I don't know why it ends as it seems to have an infinit loop, but it does end. I'm baffeled to what is going on. If anyone can help, it would be geatly appreciated. Thanks
This is the sql query when I execute this code:
SELECT iogc_instrument.instrument_number, iogc_instrument.iogc_agreement_number FROM ilrs.iogc_instrument WHERE iogc_instrument.instrument_number IN ('2190301020001860','2190301020001863','2000000000005738','2000000000005739')
union SELECT iogc_instrument.instrument_number, iogc_instrument.iogc_agreement_number FROM ilrs.iogc_instrument WHERE iogc_instrument.instrument_number IN ('2190301020001860','2190301020001863','2000000000005738','2000000000005739'.....goes to 254 values)
WHERE iogc_instrument.instrument_number IN ('2190301020001860','2190301020001863','2000000000005738','2000000000005739'.....goes to 254 values)
union SELECT iogc_instrument.instrument_number, iogc_instrument.iogc_agreement_number FROM ilrs.iogc_instrument WHERE iogc_instrument.instrument_number IN ('2190301020001860','2190301020001863','2000000000005738','2000000000005739'.....goes to 254 values)
WHERE iogc_instrument.instrument_number IN ('2190301020001860','2190301020001863','2000000000005738','2000000000005739'.....goes to 254 values)
This is the code I have.
dim arrWords, iLen, icounter, counter, inValues
arrWords = split(strInstruments,","
arrWords2 = split(strReserves,","
icounter = 0
counter = 0
invalues = ""
'An other test solution
do while icounter <= ubound(arrwords2)
if counter < 253 and icounter < ubound(arrwords2) then
invalues = invalues & arrwords2(icounter) & ","
elseif counter = 254 or counter = ubound(arrwords2) then
invalues = invalues & arrwords2(icounter)
end if
if icounter = ubound(arrwords2) then
tempSql = tempSql & strSQL & " AND band_reserve.reserve_number IN ('" & invalues & "')"
elseif counter = 254 then
tempSql = tempSql & strSQL & " AND band_reserve.reserve_number IN ('" & invalues & "') union "
invalues = ""
counter = 0
end if
icounter = icounter + 1
counter = counter + 1
loop
I don't know why it ends as it seems to have an infinit loop, but it does end. I'm baffeled to what is going on. If anyone can help, it would be geatly appreciated. Thanks