293:
294: DECLARE
295: -- Delete predefined serial numbers
296: cursor c1 is select group_mark_id from
297: mtl_serial_numbers
298: where group_mark_id = v_trx_header_id
299: and current_status = 6
300: for update of group_mark_id nowait;
301: BEGIN
299: and current_status = 6
300: for update of group_mark_id nowait;
301: BEGIN
302: open c1 ;
303: delete mtl_serial_numbers
304: where group_mark_id = v_trx_header_id
305: and current_status = 6;
306: close c1 ;
307: EXCEPTION
311:
312: DECLARE
313: -- Unmark serial numbers
314: cursor c2 is select group_mark_id from
315: mtl_serial_numbers
316: where group_mark_id = v_trx_header_id
317: for update of group_mark_id nowait;
318: BEGIN
319: open c2 ;
316: where group_mark_id = v_trx_header_id
317: for update of group_mark_id nowait;
318: BEGIN
319: open c2 ;
320: update mtl_serial_numbers
321: set group_mark_id = null,
322: line_mark_id = null,
323: lot_line_mark_id = null
324: where group_mark_id = v_trx_header_id;
330:
331: DECLARE
332: -- Delete lot and serial records from temp tables
333: cursor c3 is select group_header_id from
334: mtl_serial_numbers_temp
335: where group_header_id = v_trx_header_id
336: for update of group_header_id nowait;
337: BEGIN
338: open c3 ;
335: where group_header_id = v_trx_header_id
336: for update of group_header_id nowait;
337: BEGIN
338: open c3 ;
339: delete mtl_serial_numbers_temp
340: where group_header_id = v_trx_header_id;
341: close c3 ;
342: EXCEPTION
343: WHEN OTHERS then
409: WHERE mmtt.transaction_header_id = hdr_id AND mmtt.transaction_temp_id
410: IS NOT NULL AND mmtt.transaction_header_id IS NOT NULL);
411:
412:
413: DELETE FROM mtl_serial_numbers_temp
414: WHERE group_header_id = hdr_id AND
415: transaction_temp_id NOT IN
416: (SELECT mmtt.transaction_temp_id FROM
417: mtl_material_transactions_temp mmtt
760: null;
761: completed := 4;
762: else
763: -- Bug 4062450 performance change.
764: DELETE /*+ INDEX(MSN MTL_SERIAL_NUMBERS_N2) */
765: FROM mtl_serial_numbers MSN
766: WHERE current_status = 6
767: AND group_mark_id = -1
768: AND (MSN.inventory_item_id, MSN.current_organization_id) in
761: completed := 4;
762: else
763: -- Bug 4062450 performance change.
764: DELETE /*+ INDEX(MSN MTL_SERIAL_NUMBERS_N2) */
765: FROM mtl_serial_numbers MSN
766: WHERE current_status = 6
767: AND group_mark_id = -1
768: AND (MSN.inventory_item_id, MSN.current_organization_id) in
769: (select inventory_item_id,ORGANIZATION_ID