The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT *
FROM ic_purg_prm
WHERE criteria_id = l_criteria_id
AND process_ind = 1
AND delete_mark = 0;
l_select_stmt LONG;
Depending on the Purge_precision select the rows eligible for purge, instead of hardcoding to 9 decimal precisions
If loct_onhand quantity is zero or less than the 0.1^purge_precision then it is eligible for purge*/
-- l_where1 := l_where1 || ' AND (a.loct_onhand = 0 OR abs(a.loct_onhand) <= .000000001)';
/* l_where2 := l_where2 || ' AND NOT EXISTS (SELECT item_id FROM IC_TRAN_PND p '||
' WHERE doc_type = '||'''XFER''' ||
' AND a.whse_code = p.whse_code '||
' AND a.lot_id = p.lot_id '||
' AND a.location = p.location '||
' AND a.item_id = p.item_id '||
' AND p.delete_mark = 0) '; */
l_select_stmt := 'SELECT b.item_no,a.whse_code,a.location, ' ||
' a.loct_onhand,a.rowid, a.loct_onhand2,a.qchold_res_code, ' ||
' a.lot_status,decode(c.lot_no,'||''''||l_default_lot||''''||',NULL,c.lot_no) lot_no ' ||
' FROM ic_loct_inv a,ic_item_mst b,ic_lots_mst c ' ||
' WHERE a.item_id = '|| l_where_clause || l_where1
||' and a.lot_id = c.lot_id and b.item_id = c.item_id ';
DBMS_SQL.PARSE(l_cursor_id,l_select_stmt,DBMS_SQL.V7);
DELETE
FROM ic_loct_inv
WHERE rowid = l_row_id;
/* Added IF Condition -- Update the ic_purg_prm only if it is called from Purge Empty Balances Form*/
IF (p_criteria_id > 0) THEN
UPDATE ic_purg_prm
SET run_date = sysdate,
process_ind = 2,
deleted_rowcount = l_del_count,
zero_rowcount = l_zero_count
WHERE criteria_id = p_criteria_id;