develooper Front page | perl.beginners | Postings from August 2009

delete 20 000 records in oracle from perl

Thread Next
luke devon
August 16, 2009 23:00
delete 20 000 records in oracle from perl
Message ID:

I wanted to delete some unwanted data in one of my oracle
database.20 000 of records are there. This is actually on production .
manually to delete  a record , it takes 2 mins of time. 

So now i decided to write a perl script to do this function
by learning on the web.  Can somebody give me a exact guide to delete
that amount of data , without giving any impact for performance of the
database and i would like to ask what is the better way to do such a
execution ?
Do we have to implement more threads ?

as i mentioned below , i am tring to write the code.   

#!/usr/bin/perl -w 
use DBI; 
my ($dbh, $sth); 
### Perform the connection using the Oracle driver 
  $dbh = DBI->connect( "dbi:Oracle:dbname", "login ID", "password" , { 
      PrintError => 0,   ### Don't report errors via warn(  ) 
      RaiseError => 1    ### Do report errors via die(  ) 
  } ); 
  ### Prepare a SQL statement for execution 
  $sth = $dbh->prepare( "DELETE rec1,rec2 * FROM TB1" ); 
  ### Execute the statement in the database 
  $sth->execute(  ); 
  ### Disconnect from the database 
  $dbh->disconnect(  ); 

Many Thanks 

      New Email addresses available on Yahoo!
Get the Email name you've always wanted on the new @ymail and @rocketmail. 
Hurry before someone else does!
Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About