Hi all,
I have table tb1 with 60 million and i have another table tb2 with 30 million
I want to delete tab2 with respect to table one
For this i wrote a procedure to dellete this . but when iam trying to execute after 4 min the procedure is not running due to large data:
PROCEDURE temp (id IN NUMBER)
AS
CURSOR c
IS
SELECT order
FROM tab1
WHERE (status = 'A'
AND billdt < ADD_MONTHS (SYSTIMESTAMP, -12))
OR (status IN ('B','C')
AND orderdt < ADD_MONTHS (SYSTIMESTAMP, -12));
TYPE ordernum IS TABLE OF tab1.order%TYPE;
order1 ordernum;
BEGIN
OPEN c;
LOOP
FETCH c
BULK COLLECT INTO order1
LIMIT 1000;
FORALL i IN 1 .. order1.COUNT
DELETE FROM tb2
WHERE id = order1 (i);
EXIT WHEN c%NOTFOUND;
END LOOP;
COMMIT;
EXCEPTION
WHEN OTHERS
THEN
ROLLBACK;
END ;
can any one help me!!!!!!!!
Thanks in advance