Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

delete from table with given count

714604Dec 14 2009 — edited Dec 14 2009
Hi,
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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 11 2010
Added on Dec 14 2009
3 comments
498 views