Steve,
The placeholders already have the values bound
$sth->bind_param(1,$id, { TYPE => SQL_VARCHAR })
$sth->bind_param(2,$passwd, { TYPE => SQL_VARCHAR })
Just do:
$sth->execute();
Regards,
Paul.
Steve Shapero wrote:
> howdy--
>
> i am using DB2 7.2.3 on RH linux 7.2. i am trying to bind some parameters
> to an INSERT statement and getting the following errors:
>
> CLI0125E Function sequence error.
> Explanation: This function was called in an invalid sequence.
>
> SQLSTATE=HY010 (which has the following *3* possible meanings):
> 1. The function was called while in a data-at-execute (SQLParamData(),
> SQLPutData()) operation.
>
> 2. The function was called while within a BEGIN COMPOUND and END COMPOUND
> SQL operation.
>
> 3. An asynchronously executing function (not this one) was called for the
> StatementHandle and was still executing when this function was called.
>
> personally i find the first one to be the most likely explanation.
>
> here's my code ( i know the die is redundant, just trying to get all
> possible errors):
>
> my $dbh = DBI->connect("dbi:DB2:$DB_NAME", "satdb", "satdb", {RaiseError =>
> 1, AutoCommit => 1}) || die "Unable to connect to db: $!\n";
> my $sth = $dbh->prepare("insert into dbsat001.user_info (username, passwd)
> values (?, ?) ") or die "Failed to prepare statement: " . $dbh->errstr;
>
> for(...) {
> my $rc = $sth->bind_param(1,$id, { TYPE => SQL_VARCHAR }) or die
> $sth->errstr;
> $sth->bind_param(2,$passwd, { TYPE => SQL_VARCHAR }) or die $sth->errstr;
> $sth->execute($id, $passwd) or die "Died here: " . $dbh->errstr;
> }
>
> the program craps out on the $sth->execute, not the actual bind_param. i've
> tried fooling with the type to no avail. is there some magic incantation
> that i have to utter for DB2 to deal with this?
>
> thanks
> steve