How to delete constant no. of records

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RaviRajhulk
    New Member
    • Feb 2008
    • 12

    How to delete constant no. of records

    I have million records and i want to delete 10000 records each time....how to do that?
    I have written the following query for that
    loopcount=ceil (1000000/10000)
    while (i<loopcount)
    {
    delete from table where =(every time i need to delete 10000 records)

    commit;
    i=i+1;
    }

    I am confused what to write in the where clause so that in every while statement 10000 records are deleted.
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    you need to use ROWNUM for the purpose.

    Comment

    Working...