File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Automated process to truncate a table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Automated process to truncate a table" Watch "Automated process to truncate a table" New topic

Automated process to truncate a table

Praveen RajKumar

Joined: Aug 23, 2012
Posts: 6

We have a table where we keep track of recent transactions.
Whenever the no.of records count reaches 10000 we truncate the table.

Till now we are doing this process manually.
Is there any automated process to write a procedure and schedule it to complete this activity.

Ashwin Sridhar
Ranch Hand

Joined: Jul 09, 2011
Posts: 272

Yes you could do it. You could create a schedule job for your stored procedure. Refer this .

You could also have this done other way round. A Java processor calling your stored procedure and a Shell Script calling your Java Processor and you create a schedule job for this script file.

The first approach would be easier to implement.

Ashwin Sridhar
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46437
I presume by truncate you mean decapitate, otherwise you would lose the newer records.
I agree. Here's the link:
subject: Automated process to truncate a table
It's not a secret anymore!