So I have a FORALL bulk collection that I am using to insert values into a table.
Usually I would use a loop for the sequence field that has to be populated. Example would be like this........
seqno = seqno +1
.....and then I would loop through for each record it would increase by 1 as they are inserted.
SELECT bis_part, bis_part_org, bis_store, bis_bin, bis_lot, bis_qty
BULK COLLECT INTO V_STTK_CLTN
FROM table1
WHERE bis_bin = 'DIRECT'
AND bis_store = p_org;
FORALL INDX IN 1 .. V_STTK_CLTN.COUNT
INSERT INTO table2
(stl_part,
stl_part_org,
stl_trans,
stl_store,
stl_bin,
stl_lot,
stl_expqty,
stl_phyqty,
stl_rtype,
stl_type,
stl_line )
VALUES
(V_STTK_CLTN(INDX).bis_part,
V_STTK_CLTN(INDX).bis_part_org,
ctrans,
V_STTK_CLTN(INDX).bis_store,
V_STTK_CLTN(INDX).bis_bin,
V_STTK_CLTN(INDX).bis_lot,
V_STTK_CLTN(INDX).bis_qty,
'',
'STTK',
'STTK',
seqno);
How could I do this with a collection since I am using FORALL without a loop?
The seqno value is where i need the sequence. Each time this is run it will insert these records into the same table but the sequence must start with one each time as it is a sequence for the collection not the whole table....make sense?