Advertisement
Guest User

Untitled

a guest
Feb 7th, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.81 KB | None | 0 0
  1. #!/usr/bin/perl
  2. use DBI;
  3. $ENV{"ORACLE_HOME"}="/home/oracle/app/oracle/product/11.2.0/dbhome_1";
  4. $ENV{"NLS_LANG"}="RUSSIAN.CL8KOI8R";
  5.  
  6. #my $dbh = DBI->connect("dbi:Oracle:host=hovrino;sid=ORCL", "DAS", "password", {RaiseError=>0,PrintError=>0,AutoCommit=>0})
  7. #  || oraerror('Connect','__EXIT__');
  8. # $dbh->do("alter session set NLS_NUMERIC_CHARACTERS='.,'");
  9.  
  10. my $dbh = DBI->connect('DBI:Pg:dbname=gen','postgres','password') || die $DBI::errstr;
  11. #my $dbh = DBI->connect('DBI:mysql:nas:localhost','nas','password') || die $DBI::errstr;
  12. my $sth=$dbh->prepare('insert into repeats values(?,?,?,?)');
  13. open(my $fl,"<","repeats-g38-201505-nodoppel-chr1.csv");
  14. my $res;
  15. while(<$fl>) {
  16.   chomp;
  17.   my @val=split(/,/);
  18.   if(! ($res=$sth->execute(@val))) {
  19.     print "Error $res\n";
  20.     last;
  21.   }
  22. }
  23. $dbh->commit();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement