*
The moose likes JDBC and the fly likes Emptying a table but only by deleting a specified number of rows at a time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Emptying a table but only by deleting a specified number of rows at a time" Watch "Emptying a table but only by deleting a specified number of rows at a time" New topic
Author

Emptying a table but only by deleting a specified number of rows at a time

Kim Lilienfeld
Greenhorn

Joined: Apr 13, 2004
Posts: 25
Hi

I've got the problem where I need to empty a table (containing approx 360 000 rows) but I am only allowed to delete 50 000 rows at a time. It is an informix database and the table has no incrementing id.

Any help would be appreciated.

Thanks.
Kim
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

What, and it won't just let you do this?:


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Henrique Sousa
Ranch Hand

Joined: Apr 29, 2004
Posts: 92
Hi Kim,

Maybe you could use some database-specific query using the rowid. I haven't used informix yet, but it would be something like

(of course, I assumed rowid starts with 1)


Henrique Sousa<br />SCJP 1.4<br /> <br />All men die, not all men really live - Braveheart, 1995
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
this is the ROWID example of ORACLE.

ROWID
------------------
AAAL+ZAAEAAAAAdAAA
AAAL+ZAAEAAAAAdAAB
AAAL+ZAAEAAAAAdAAC
AAAL+ZAAEAAAAAdAAD
AAAL+ZAAEAAAAAdAAE
AAAL+ZAAEAAAAAdAAF
AAAL+ZAAEAAAAAdAAG
AAAL+ZAAEAAAAAdAAH
AAAL+ZAAEAAAAAdAAI
AAAL+ZAAEAAAAAdAAJ
AAAL+ZAAEAAAAAdAAK

Kim Lilienfeld
Greenhorn

Joined: Apr 13, 2004
Posts: 25
Thanks for all the help guys

Am gonna play around and see what works!

Thanks a million and 2..
K
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081





(of course, I assumed rowid starts with 1)


I think in Oracle it should be like

delete from your_table where rownum < 50001
[ October 19, 2004: Message edited by: Shailesh Chandra ]

Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Originally posted by Shailesh Chandra:

(of course, I assumed rowid starts with 1)<hr></blockquote>


I think in Oracle it should be like

delete from your_table where rownum < 50001
[/QB]


cent percent AGREEMENT
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Emptying a table but only by deleting a specified number of rows at a time
 
Similar Threads
Trinidad's table range navigation control
Reading a stream from a socket
OutOfMemoryError when using ResultSet
JTable -- Help please
jtable and jscrollpane question