Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> How to delete all rows in a table except for 10 of them?

How to delete all rows in a table except for 10 of them?

From: Will Dieterich <wdieteri_at_rmi.net>
Date: 1997/03/19
Message-ID: <5gp844$1ib$1@news1.rmi.net>#1/1

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US