Re: help with odd DBI perpare/execute errors

William Bulley <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Message-ID <[email protected]>
According to "Martin J. Evans" <[email protected]> on Wed, 06/03/15 at 09:15:
> 
> So, when this fails, what is the value of $value.

I just ran it again.  The value is 547.

> Assuming you have RaiseError set, you can just put an eval
> around the execute and if $@ is set, print out $value.

I don't.  I have a print statement in front of the execute to
show my what I am passing to the execute() method.

> Strictly speaking you do not need to do this - ? is fine.
> DBD::Oracle also supports named parameters e.g., ':myparam'
> which only has an advantage if you want to use :myparam
> more than once in the SQL.

The query is quite complex -- two SELECT statements connected
by a UNION statement -- and the "column = ?" syntax is used
twice.  I changed the "?" to ":myparam" in both places and I
still get the error:

   DBD::Oracle::st execute failed: called with 1 bind
   variables when 0 are needed [for Statement...

> Either because you omitted the value from execute

In this case, it was not omitted.

> but more likely because you need to associate $value
> with the NAMED parameter i.e., call bind_param.

That will be my next test, but I don't hold out much hope for
that working either (I've never had to do this in the past).

> Tell us the column type of 'column' and the value of $value
> when the original code fails. If this does not enlighten you,
> reduce this to a small reproducible script and re-run with
> ora_verbose set to 7. Paste the output somewhere we can view it.

The Oracle type for the column in question is NUMBER.  I assumed
that any integer value would be compatible.  The value is 547 for
the run that just failed.

Never heard of ora_verbose -- where is this to be set?  Just in
my code somewhere, or on the DBI->connect() method, or where?

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.