in reply to Can't execute statements with DBD::Oracle

I just get this: DBD::Oracle::st fetchrow_array failed: ERROR no statement executing (perhaps you need to call execute first) [for Statement "select npi, entity_type_code from system.physician where npi = 1326041310"] at upload-npi.pl line 31. until I hit ^C. This is my code:

This may be your code, but it is not the code you run. This code has just 18 lines, perl would not report an error in line 31. Show us the real code.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Replies are listed 'Best First'.
Re^2: Can't execute statements with DBD::Oracle
by aremaref (Initiate) on Jun 15, 2009 at 19:22 UTC
    Well, it's the same code, I just took out the comments. Edit: anyway, I reinstalled both DBI and DBD::Oracle and I think it's working now. Thanks.
    #!usr/bin/perl use DBI; use strict; #$ENV {"ORACLE_HOME"} ="C:\\oraclexe\\app\\oracle\\product\\10.2.0\\"; #my $file = "npi1.txt"; my $dsn = 'DBI:Oracle:XE'; my $user = 'scott'; my $pass = 'tiger'; my $dbh; my $sth; $dbh = DBI->connect($dsn, $user, $pass, {RaiseError => 1, PrintError = +> 0}) || die $dbh->errstr; #open(IN,$file); #my $line = <IN>; #my $count = 0; #while (<IN>) #{ # my $n = 'physician'; # $sth = $dbh->prepare('insert into :table-name (:values)'); $sth = $dbh->prepare('select npi, entity_type_code from system.phy +sician where npi = 1326041310'); # $sth->bind_param(":table-name", $n); # $sth->bind_param(":values", $_); $sth->execute(); # $count++; while( my @line = $sth->fetchrow_array ) {print @line;} #} #close(IN); $sth->finish(); $dbh->disconnect();