http://www.perlmonks.org?node_id=1013945

shanknbake has asked for the wisdom of the Perl Monks concerning the following question:

Error: Can't bind unknown parameter marker ':p4' My code:
my $returnValue; $sth = $self->GetDatabase()->prepare( "CALL mySchema.myStoredProcedure +(?,?,?)" ); $sth->bind_param(1,$p1); $sth->bind_param(2,$p2); $sth->bind_param(3,0); $sth->bind_param_inout(4,\$returnValue,20); $sth->execute(); $sth->finish();
I'm not sure what the problem could be... everything (AFAIK) seems right. Anyone have any ideas?

Replies are listed 'Best First'.
Re: DB2 error: "Can't bind unknown parameter marker ':p4'"
by runrig (Abbot) on Jan 19, 2013 at 17:15 UTC
    AnonyMonk above has it right...you have 3 ?'s, and 4 binds. If you are trying to get the return value from the stored procedure, try using the $sth->{db2_call_return} attribute.
      $sth->{db2_call_return}; is EXACTLY the thing I've been missing!!! Thank you so much! I've not ONCE seen an example where someone uses that! TYVM!
Re: DB2 error: "Can't bind unknown parameter marker ':p4'"
by Anonymous Monk on Jan 18, 2013 at 04:02 UTC

    I'm not sure what the problem could be... everything (AFAIK) seems right. Anyone have any ideas?

    Sure you are :) Can't bind unknown parameter marker is a very specific error message, and since :p4 doesn't occur in the cod you posted, it must occur in the stored procedure

      I'm thinking that the error is in the way that I'm calling the stored procedure... does that look okay?
        The stored procedure looks to be working fine - I tested it manually using the Data Studio tool. So it must be something funky with the way that I'm calling it...