delete from table with given count
714604Dec 14 2009 — edited Dec 14 2009Hi,
I wanted to delete the records from my table on a count of 10 records per one time.
And I am trying the below query for that....but it is deleting the entire records at a single time.
declare
cursor c1 is select * FROM sat;
--WHERE RELATION_TYPE_CODE='AUTOPLACEMENT'
--DT VARCHAR2(10):='';
CNT NUMBER:=10;
i sat%rowtype;
BEGIN
OPEN C1;
LOOP
if cnt = 10 then
FETCH C1 INTO i;
EXIT WHEN C1%NOTFOUND;
DELETE from sat;
dbms_output.put_line(cnt||' Records deleted for ');
end if;
end loop;
close c1;
--commit;
end;
Whenever I execute the query ..it should delete only 10 records per execution.
How do I do that, please let me know.
Thanks