Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> How to delete all rows in a table except for 10 of them?
I have over 200 tables(with various numbers of rows) where I need to delete all but 10 rows from each of them(rows that remain are not important, just that each of the tables will only have 10 rows when it is completed).
Needless to say the psedudo-row rownum will not work with this, so I am
looking some quick and dirty way of doing it.
So far the best way I can determine do to this is to sub-select inside the
delete statement that will select the first 10 rows, here rownum will work,
and then delete the rows
that are not in sub-select. Unfortunatly, less then half of the tables have
any similar column names, so I am looking at a fair amount of manual work.
-- William Dieterich Call Sign: KD4LZE Email: wdieteri_at_rmi.net "As the flowers are all made sweeter by the sunshine and the dew, so this old world is made better by the lives of folks like you" inscription on the tombstone of Bonnie Parker of Bonnie and Clyde fame.Received on Wed Mar 19 1997 - 00:00:00 CST
![]() |
![]() |