>
> Having difficulty with an error message "no statement executing"
> against the
> following
>
> my $dbh = DBI->connect($DATA_SOURCE,$USER,$PASSWORD,{AutoCommit => 0,
> RaiseError => 0, PrintError => 0 })   or error("Can`t connect to db:
> DBI::errstr", 1,2);
>
> # DBI->trace(2);
>
>
> my $sth = $dbh->prepare(qq[declare \@p int exec spfoo \@p output]);
> $sth->execute(); # Fails here
>
Your procedure doesn't generate seem to generate a result set.  You probably
need to bind_param_inout() to get the value of your output and declare
something to capture @p.  (i.e. ? = \@p) or, select \@p to return it as a
result set.  Since you're using DBD::Sybase, there may be better information
there.

> do {
>     while(my $data = $sth->fetch) {
>         if($sth->{syb_result_type} == 4042) {  # This is the OUTPUT param
>                 print "Another Result".$data->[0]."\n";
>         }
>     }
> } while($sth->{syb_more_results});
> print "\nResult: ".CS_STATUS_RESULT;
> print "\n";
> $sth->finish;
> $dbh->disconnect;
>
>
> Output is
> no statement executing at ./dump.pl line 28.
> Result: 4043
>
>
>
> Stored Proc is
>
> CREATE   PROCEDURE foo
>       @p3 varchar(100) OUTPUT
> as
>
> SET @p3 = 5
> GO
>
> I have tried against most examples I can find and have no
> difficulty binding
> columns etc.
>
> MSSQL v 7.0
> Linux
> FreeTDS
> sybase-11.9.2
> perl v5.6.1
>


Reply via email to