in reply to Re^4: how could i insert data from a file to oracle database
in thread how could i insert data from a file to oracle database

it did not worked can you suggest any other way.
  • Comment on Re^5: how could i insert data from a file to oracle database

Replies are listed 'Best First'.
Re^6: how could i insert data from a file to oracle database
by tuxz0r (Pilgrim) on Nov 13, 2007 at 19:31 UTC
    What specifically did not work? Can you post some output and the code you tried? I'd be glad to look it over.

    ---
    echo S 1 [ Y V U | perl -ane 'print reverse map { $_ = chr(ord($_)-1) } @F;'
    Warning: Any code posted by tuxz0r is untested, unless otherwise stated, and is used at your own risk.

      this is what i tried
      #!/usr/bin/perl
      use DBI;
      $user = "akoleti";
      $passwd = "something";
      $dbh = DBI-> connect("dbi:Oracle:host=172.31.0.87;sid=dola;port=1521", $user, $passwd) or die "Can't connect to database $DBI::errstr\n";
      open( SQL, "gene_enzyme.txt") or die $!;
      my @statements = <SQL>;
      foreach my $stmt( @statements ){ $dbh->do($_);
      }
      error
      DBD::Oracle::db do failed: ORA-24373: invalid length specified for statement (DB D ERROR: OCIStmtPrepare) at oracle1.pl line 12, <SQL> line 3118.
        The problem is you are still passing $_ to $dbh->do when you assign each statement to $stmt in the foreach loop. Use $dbh->do($stmt). That's what the "invalid length specified for statement" messages is about.

        ---
        echo S 1 [ Y V U | perl -ane 'print reverse map { $_ = chr(ord($_)-1) } @F;'
        Warning: Any code posted by tuxz0r is untested, unless otherwise stated, and is used at your own risk.