My stored proc returns one output parameter, and along with it it has alot of print statements like below
Create Proc
myParam out
begin
select 'this is a log statement'
select @myParam = 0
end
I am calling the above from a perl script using DBI, for a Sybase server. I am not sure how to get print the value of select print statement as well as myParam?
Here's what I have done
$sth = $fdadbh->prepare($db_query) or die "Could not prepare statement: ". $fdadbh->errstr;
$sth->execute() or die "Couldnt execute statement: ".$sth->errstr;
do {
while($row = $sth->fetchrow_arrayref) {
print join("\t\t", @$row), "\n";
}
} while ($sth->{syb_more_results});
Output I get is this is a log statement 0 0
If I remove the line select @myParam = 0
and run it again, I get
this is a log statement
0
-1
How do I remove that 0 coming additionally. Also, Is there any way of cpturing the outputParam in a variable (apart from traversing and keeping the last value)