Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to delete all rows in a table except for 10 of them?
You could try this - it may be faster than deleting, and should work for any table (warning - may not be syntactically correct - don't have my manual right now)
create table new_table as select * from old_table where rownum < 11;
truncate old_table;
insert into old_table select * from new_table;
drop table new_table;
OR, if you don't care where the new table is:
create table new_table as select * from old_table where rownum < 11;
drop table old_table;
rename new_table to old_table;
-- --- Allen Kirby AT&T ITS Production Services akirby_at_att.com Alpharetta, GA.Received on Thu Mar 20 1997 - 00:00:00 CST
![]() |
![]() |