0

I have to delete millions of rows from table.
what i found on net
Delete rows and commit after some deletion.

Script is

BEGIN
 LOOP
  delete FROM FORM_RESPONSES_DATA 
   where FK_SERVICEREQUEST_ID = 95581 and rownum < 10000;

  exit when SQL%rowcount < 9999 ;
  commit;

 END LOOP;
 commit;
END;

But this script not working.
And i also want to know how can i call this script from java code.

thanx

gifpif
  • 4,507
  • 4
  • 31
  • 45
  • 1
    it ain't look like a java code?!!! – Kick Buttowski Dec 11 '13 at 08:06
  • why dont you use simple delete query like delete from table where ....? – SpringLearner Dec 11 '13 at 08:07
  • @JqueryLearner my database server is very slow – gifpif Dec 11 '13 at 08:09
  • @Pawanmishra Might be useful http://stackoverflow.com/questions/644975/deleting-a-lot-of-data-in-oracle – Jacob Dec 11 '13 at 08:09
  • Why did you use the loop in the script? Do you want to delete a number of records, then commit and then delete the next number of records? Or do you just want to delete all records in one transaction? – RFerwerda Dec 11 '13 at 08:10
  • What database are you using? Do you want to delete _all_ rows? Is the number of rows left in the table rather small or still quite big? – Trinimon Dec 11 '13 at 08:12
  • @Pawanmishra well do you want to delete some of the records or you want to delete all the records?Are there any primary key column in the table?Post your question with this updates and there is no java code here so java tag is not neccessary.Try with sql query first – SpringLearner Dec 11 '13 at 08:13
  • You might want to take a look at the Java Persistence API (or JPA): https://en.wikipedia.org/wiki/Java_Persistence_API – Gijs Overvliet Dec 11 '13 at 08:35

0 Answers0