Using Perl DBI for Sybase - How do I get hold of the return value from a stored procedures? 
Author Message
 Using Perl DBI for Sybase - How do I get hold of the return value from a stored procedures?

Hi,

I've got a Sybase stored procedure which does a select and then a return.
I'm getting hold of the result set from the select, but not the return
value.

F.ex: With a Sybase stored procedure

create procedure just_any_procedure as
select ....   -- Produces the result set


Using Perl DBI with the Sybase driver (DBD::Sybase). How do I get hold of
the return value from the stored procedure after executing the
$sth->execute(); ?

Lars Markhus



Wed, 21 Sep 2005 02:00:25 GMT  
 Using Perl DBI for Sybase - How do I get hold of the return value from a stored procedures?
perldoc DBD::Sybase

--
Ron Reidy
Oracle DBA

Quote:

> Hi,

> I've got a Sybase stored procedure which does a select and then a return.
> I'm getting hold of the result set from the select, but not the return
> value.

> F.ex: With a Sybase stored procedure

> create procedure just_any_procedure as
> select ....   -- Produces the result set


> Using Perl DBI with the Sybase driver (DBD::Sybase). How do I get hold of
> the return value from the stored procedure after executing the
> $sth->execute(); ?

> Lars Markhus



Wed, 21 Sep 2005 20:29:00 GMT  
 Using Perl DBI for Sybase - How do I get hold of the return value from a stored procedures?
Thanks, I've read it, but I'm still left with the same question.

Does anyone have a code example?

Lars Markhus


Quote:
> perldoc DBD::Sybase

> --
> Ron Reidy
> Oracle DBA


> > Hi,

> > I've got a Sybase stored procedure which does a select and then a
return.
> > I'm getting hold of the result set from the select, but not the return
> > value.

> > F.ex: With a Sybase stored procedure

> > create procedure just_any_procedure as
> > select ....   -- Produces the result set


> > Using Perl DBI with the Sybase driver (DBD::Sybase). How do I get hold
of
> > the return value from the stored procedure after executing the
> > $sth->execute(); ?

> > Lars Markhus



Thu, 22 Sep 2005 18:04:44 GMT  
 Using Perl DBI for Sybase - How do I get hold of the return value from a stored procedures?

Quote:

> Thanks, I've read it, but I'm still left with the same question.

> Does anyone have a code example?

> Lars Markhus

You need to read it more thoroughly. Try

http://search.cpan.org/author/MEWP/DBD-Sybase-1.00/Sybase.pm

and then find

Handling Multiple Result Sets

and at the end of that section read this:

In particular, the return status of a stored procedure is returned as
CS_STATUS_RESULT (4043), and is normally the last result set that is
returned in a stored proc execution.

That should be enough.

--

Matt



Fri, 23 Sep 2005 11:13:22 GMT  
 Using Perl DBI for Sybase - How do I get hold of the return value from a stored procedures?


Quote:

>> Thanks, I've read it, but I'm still left with the same question.

>> Does anyone have a code example?

>> Lars Markhus

>You need to read it more thoroughly. Try

>http://search.cpan.org/author/MEWP/DBD-Sybase-1.00/Sybase.pm

>and then find

>Handling Multiple Result Sets

>and at the end of that section read this:

>In particular, the return status of a stored procedure is returned as
>CS_STATUS_RESULT (4043), and is normally the last result set that is
>returned in a stored proc execution.

>That should be enough.

However, i have found from personal experience that the docs don't
necessarily describe reality, for varying version releases of reality.

I agree that the way to go is to handle multiple result sets.  But
don't depend upon any built-in method to get the return value.
Instead, return it by selecting it explicitly in your script:



Run the command, and check for multiple return sets (usually
a good idea in any event).

(Usual disclaimers of untestedness, not to mention that i haven't
done T-SQL for a while and may have gotten some keywords switched).

--
        -john

February 28 1997: Last day libraries could order catalogue cards
from the Library of Congress.



Sat, 24 Sep 2005 14:55:01 GMT  
 Using Perl DBI for Sybase - How do I get hold of the return value from a stored procedures?

Quote:




>>> Thanks, I've read it, but I'm still left with the same question.

>>> Does anyone have a code example?

>>> Lars Markhus

>>You need to read it more thoroughly. Try

>>http://search.cpan.org/author/MEWP/DBD-Sybase-1.00/Sybase.pm

>>and then find

>>Handling Multiple Result Sets

>>and at the end of that section read this:

>>In particular, the return status of a stored procedure is returned as
>>CS_STATUS_RESULT (4043), and is normally the last result set that is
>>returned in a stored proc execution.

>>That should be enough.

> However, i have found from personal experience that the docs don't
> necessarily describe reality, for varying version releases of reality.

More likely various releases of DBD::Sybase...

Quote:
> I agree that the way to go is to handle multiple result sets.  But don't
> depend upon any built-in method to get the return value. Instead, return
> it by selecting it explicitly in your script:



> Run the command, and check for multiple return sets (usually a good idea
> in any event).


select_a_record).
But is unnecessary in the case of any recent version of DBD::Sybase.

Michael
--
Michael Peppler                              Data Migrations, Inc.

Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short or
long term contract positions - http://www.mbay.net/~mpeppler/resume.html



Sat, 24 Sep 2005 23:08:12 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Returning results from a stored procedure/function using DBI and Oracle

2. Getting values using DBI

3. HELP: Need a little help on using PerlV5.003 with a Sybase stored procedure

4. HELP: Need a little help on using PerlV5.003 with a Sybase stored procedure

5. DBD::Sybase, Using Stored Procs with output vars

6. HELP: Need a little help on using PerlV5.003 with a Sybase stored procedure

7. splitting array, each element holding multiple values into array with single values

8. Return value from a stored procedure.

9. Using Embedded SQL vs Stored procedures in Perl DBI?DBD for Oracle

10. Connecting to Sybase using Perl DBI

11. Calling Oracle Stored Procedure from Perl using DBD/DBI

12. How to get return value from an Oracle stored function using DBI..

 

 
Powered by phpBB® Forum Software