Hello All, I want to call a sybase stored procedure from my perl script & store the output parameter of script in a variable. Script takes 5 input parameters & has one int type output prameter. Below is part of my script. Everytime I run this, I only get output as retVal = 0 (which is return value of stored procedure) but I cannot get the output parameter of a stored procedure. (I get output values when I ececute procedure from DB prompt) Can somebody let me know what am I missing?
my $sql = <<EOF; exec prcLoadTransacMove \@TaxYear=?,\@ClientId=?, \@beginRecId=?, \@endRecId=?, \@UI_Call=?, \@RecCount out EOF my $sth = $dbh->prepare("$sql") or print "Cannot prepare $sql: $DBI::errstr\n"; print "Procedure sql prepared: $sql \n"; print "prcLoadTransacMove $TaxYear, $ClientId, $MinRecId, $MaxRecId, $UiCall\n"; $sth->bind_param(1, $TaxYear, SQL_INTEGER); $sth->bind_param(2, $ClientId, SQL_CHAR); $sth->bind_param(3, $MinRecId, SQL_INTEGER); $sth->bind_param(4, $MaxRecId, SQL_INTEGER); $sth->bind_param(5, $UiCall, SQL_INTEGER); $sth->execute() or print "Can not execute $sql in with params == taxYear:$TaxYear clientId:$ClientId MinRecId:$MinRecId MaxRecId:$MaxRecId UiCall:$UiCall, $DBI::errstr\n"; { my ($data, $retVal); while ($data = $sth->fetch) { if ($sth->{syb_result_type} == CS_PARAM_RESULT) { # it's a PARAM result my $ProcessNum = $data->[0]; print "ProcessNum = $ProcessNum\n"; } elsif ($sth->{syb_result_type} == CS_STATUS_RESULT) { # it's a procedure STATUS result $retVal = $data->[0]; print "retVal = $retVal\n"; print ("prcProcessRunCore retVal=$retVal") if ($retVal != 0); } else { print ("prcProcessRunCore output: " . join("|", @$data)); } } redo if ($sth->{syb_more_results}); } $sth->finish; Thanks in advance. Regards, Kavita :-)