help with odd DBI perpare/execute errors

William Bulley <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Message-ID <[email protected]>
Environment Perl script trying to query Oracle 11g database:

   FreeBSD 9.3-STABLE

   DBI 1.633

   oracle8-client 0.2.0

   DBD::Oracle 1.19

I have no trouble connecting with the Oracle database.  And I do
recover data when I use the temporary workaround described below.

I have a query/prepare setup outside a foreach loop where I execute()
the prepared query something like this, only more complex:

   my $query = "select column from table where column = ?";

   my $sth = $dbh->prepare ($query);

   foreach ()
   {
	$sth->execute($value);
   }

I was getting invalid string ORA-0911 errors at the question mark.
I then replaced the question mark with a number (555) and made the
execute() call just "$sth->execute();"

This worked.  But I really needed to bind to the $value variable
in the foreach loop.

In reading the DBI POD it said for Oracle the "?" is turned into
":p1" (in this case).  So I replaced the question mark with :p1.

The prepare statement no longer generated an error, instead the
execute statement generated the error:

   DBD::Oracle::st execute failed: called with 1 bind variables
   when 0 are needed [for Statement ... ] at script.pl line xxx.

Can any one help me figure out this confusing situation?  BTW, I
have been using Perl for twenty years and DBI for perhaps ten,
and I have used this query/prepare/bind/execute methodology in
the past with success.  Something is different, but I don't know
what to look for.

Regards,

web...

-- 

 /"\   ASCII RIBBON          / William Bulley
 \ /   CAMPAIGN AGAINST     / 
  X    HTML E-MAIL AND     / E-MAIL: [email protected]
 / \   LISTSERV POSTINGS  /

72 characters width template ----------------------------------------->|
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.