An Oracle blog – Amardeep Sidhu

Little bit of fun with Oracle and the related technologies…

Archive for the ‘Delete’ tag

Delete Delete Faster Faster ;)

with 3 comments

2-3 days ago, I came across a code, intended to make delete faster. Just have a look ;)

.
.
.
LOOP
SELECT COUNT (1)
INTO v_cnt
FROM table1
WHERE ROWNUM < 2;

IF v_cnt = 0
THEN
EXIT;
END IF;

DELETE FROM table1
WHERE ROWNUM < 1000;

COMMIT;
v_cnt := 0;
END LOOP;
.
.
.

Written by Sidhu

October 8th, 2009 at 8:53 pm

Posted in SQL

Tagged with ,